Giter Site home page Giter Site logo

johanvs / appupdater Goto Github PK

View Code? Open in Web Editor NEW

This project forked from javiersantos/appupdater

0.0 1.0 0.0 1.78 MB

A library that checks for your apps' updates on Google Play, GitHub, Amazon, F-Droid or your own server. API 8+ required.

License: Apache License 2.0

Java 100.00%

appupdater's Introduction

AppUpdater

Android Library

Android Library that checks for updates on Google Play, GitHub, Amazon, F-Droid or your own server. This library notifies your apps' updates by showing a Material dialog, Snackbar or notification. Check out the wiki.

Sample Project

You can download the latest sample APK from Google Play:

How to include

Add the repository to your project build.gradle:

repositories {
    maven {
        url "https://jitpack.io"
    }
}

And add the library to your module build.gradle:

dependencies {
    compile 'com.github.javiersantos:AppUpdater:2.0.2'
}

Usage

Add INTERNET and ACCESS_NETWORK_STATE permissions to your app's Manifest:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Activity

AppUpdater appUpdater = new AppUpdater(this);
appUpdater.start();

Fragment

AppUpdater appUpdater = new AppUpdater(getActivity());
appUpdater.start();

Customizations (Wiki)

Use the builder and add following:

// (Optional) Provide a Display mode.
// Default: Display.DIALOG
.setDisplay(Display.DIALOG)
.setDisplay(Display.SNACKBAR)
.setDisplay(Display.NOTIFICATION)
// (Optional) Provide a duration for the Snackbars. 
// Default: Duration.NORMAL
.setDuration(Duration.NORMAL)
.setDuration(Duration.INDEFINITE)
// (Optional) Provide a source for the updates.
// Check out the wiki for more documentation: https://github.com/javiersantos/AppUpdater/wiki
// Default: UpdateFrom.GOOGLE_PLAY
.setUpdateFrom(UpdateFrom.GOOGLE_PLAY)
.setUpdateFrom(UpdateFrom.GITHUB)
.setUpdateFrom(UpdateFrom.AMAZON)
.setUpdateFrom(UpdateFrom.FDROID)
.setUpdateFrom(UpdateFrom.XML)
// (Required for GITHUB, optional otherwise) Provide the GitHub user and repo where releases are available.
// Check out the wiki for more documentation: https://github.com/javiersantos/AppUpdater/wiki/UpdateFrom.GITHUB
.setGitHubUserAndRepo("javiersantos", "AppUpdater")
// (Required for XML, optional otherwise) Set the URL to the XML file with the latest version info.
// Check out the wiki for more documentation: https://github.com/javiersantos/AppUpdater/wiki/UpdateFrom.XML
.setUpdateXML("https://raw.githubusercontent.com/javiersantos/AppUpdater/master/app/update.xml")
// (Optional) Updates will be displayed only every X times the app ascertains that a new update is available. 
// Default: 1 (Always)
.showEvery(5)
// (Optional) Show dialog, snackbar or notification although there aren't updates. 
// Default: false
.showAppUpdated(true)
// (Optional) Customize the dialog title, description and buttons
.setDialogTitleWhenUpdateAvailable("Update available")
.setDialogDescriptionWhenUpdateAvailable("Check out the latest version available of my app!")
.setDialogButtonUpdate("Update now?")
.setDialogButtonDoNotShowAgain("Huh, not interested")
.setDialogTitleWhenUpdateNotAvailable("Update not available")
.setDialogDescriptionWhenUpdateNotAvailable("No update available. Check for updates again later!")
// (Optional) Set a resource identifier for the small notification icon 
.setIcon(R.drawable.ic_update)

Other features

Get the latest update and compare with the installed one (asynchronous)

AppUpdaterUtils appUpdaterUtils = new AppUpdaterUtils(this)
    //.setUpdateFrom(UpdateFrom.AMAZON)
    //.setUpdateFrom(UpdateFrom.GITHUB)
    //.setGitHubUserAndRepo("javiersantos", "AppUpdater")
    //...
    .withListener(new AppUpdaterUtils.UpdateListener() {
        @Override
        public void onSuccess(Update update, Boolean isUpdateAvailable) {
            Log.d("AppUpdater", update.getLatestVersion() + ", " + update.getUrlToDownload() + ", " + Boolean.toString(isUpdateAvailable));
        }
        
        @Override
        public void onFailed(AppUpdaterError error) {
            Log.d("AppUpdater", "Something went wrong");
        });
appUpdaterUtils.start();

ML Manager

License

Copyright 2016 Javier Santos

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

appupdater's People

Contributors

javiersantos avatar nyancrimew avatar sethgnavo avatar vicktor avatar zaldroc avatar

Watchers

IndianaJohan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.