Giter Site home page Giter Site logo

appupdater's Introduction

AppUpdater

Custom app updater for android apps

This library is a custom Android's app updater, that works with Android O and previous versions. This library main feature is that, if there is an update for the app, it downloads the APK trough the DownloadManager and also starts the PackageManager automatically to handle the downloaded APK, just how the mechanism works for the Play Store Apps.

First step to use this is to add this repository in you project build.gradle:

maven { url 'https://jitpack.io' }

Then you need to include this dependency in you app build.gradle:

compile \'com.github.elliot619:AppUpdater:-SNAPSHOT\'

If you have problems on merge of manifests, add this code to the end of you app build.gradle (You can put any version you need for the support library):

configurations.all {
    resolutionStrategy.eachDependency { details ->
        def requested = details.requested
        if (requested.group == \'com.android.support\') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.1'
            }
        }
    }
}

To check for the updates, this library looks for a JSON file hosted in a server that contains this structure:

{"currentVersion":"2.0","apkUrl":"http://www.domain.com/appFile.apk"}

To make the comparison and decide if there is an available update, the plugin checks for the versionName of the app defined in it's build.gradle against the currentVersion in the JSON file, then if versionName is lower than currentVersion, the plugin starts the download of the file defined in apkUrl. Once the file is downloaded, the PackageManager its launched and it handles the downloaded APK.

To use this plugin you need to add this line whatever you need it:

new AppUpdater(MyActivity.this).sendNetworkUpdateAppRequest("http://www.domain.com/fileDescriptor.json");

The translations for this are in english, but you can override them by putting this strings in your res/strings.xml:

<string name="update_available_title">Update available</string>
<string name="update_available_msg">Press OK to update this app</string>
<string name="update_available_subtitle">Click here to install</string>
<string name="update_error">"Thre was an error while updating, please try again later.</string>
<string name="update_provider_name">Your host</string>

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.