Code Monkey home page Code Monkey logo

updatecenter.android's Introduction

UpdateCenter

pipeline status coverage report

Manage your application updates from remote source (API / Firebase).

UpdateCenter library notifies you when there are new updates for your app. It recognizes:

  • necessary update
  • unnecessary update
  • notification about new version available

Library uses VersionDataSource interface that provides necessary values for OnVersionCheckedListener . You can implement your own VersionDataSource which provides values from any API / XML / ...

UpdateCenter has implementation of FirebaseVersionDataSource that provides values from Firebase Remote Config (How to setup).

Download

Add the jitpack.io repository:

allprojects {
 repositories {
    jcenter()
    maven { url "https://jitpack.io" }
 }
}

and:

dependencies {
    implementation 'com.github.unitedclassifiedsapps:updatecenter.android:${updateCenterVersion}'
}

Documentation

Documentation

How to use

Firebase configuration

Setup your app with Firebase as shown here

Add Firebase remote config dependency:

implementation 'com.google.firebase:firebase-config'

Via Firebase console define following parameters:

key:update_center_must_update value:[true/false]
key:update_center_should_update value:[true/false]
key:update_center_latest_version value:[semantic version string ex.: 1.2.3]

By setting up Remote Config Conditions you can control which app version gets what value (e.g. version 1.0.0 gets update_center_must_update as true but version 2.0.0 gets its value as false).

In app use

Show in sample app

Simply initialize UpdateCenter with provided FirebaseVersionDataSource:

val updateCenter = UpdateCenter(FirebaseVersionDataSource(context, FirebaseRemoteConfig.getInstance(), BuildConfig.VERSION_NAME), object : OnVersionCheckedListener {

            override fun mustUpdate(currentVersion: String, latestVersion: String) {
                //startMustUpdateActivity()
            }

            override fun shouldUpdate(currentVersion: String, latestVersion: String) {
                //startShouldUpdateActivity()
            }

            override fun notLatestVersion(currentVersion: String, latestVersion: String) {
                //showNewVersionSnack()
            }

            override fun onError(currentVersion: String, exception: Exception?) {
                //log error
            }
        })

and call check() method

updateCenter.check()

Based on your Firebase remote config configuration the appropriate OnVersionCheckedListener callback will be invoked.

Compatibility

  • Minimum Android SDK: UpdateCenter requires a minimum API level of 16.

updatecenter.android's People

Contributors

peterturza avatar ucmobdev avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.