johanvs / AppUpdater

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

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


Languages

Language:Java 100.0%