Skip to content

Repository files navigation

Android-Update-Lib

Easy to setup library for Android-Update-Server that manages updates for your Android app which cannot be distributed via Google Play or you just simply don't want to use it.

Installation

  1. Set-up your own instance of Android-Update-Server

  2. Add Android App to same Firebase project which you are using for Update Server

  3. Include this library in your project

  4. Add it to your build.gradle with:

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

    and:

    dependencies {
    implementation 'com.github.P1-Ro:Android-Update-Lib:1.1.0'
    }
  5. Set url and apiKey of your server in your strings.xml

<stringname="update_url"translatable="false">URL_HERE</string>
<stringname="update_api_key"translatable="false">API_KEY_HERE</string> 

Initialization

Initialize the Updater in your application’s main onCreate method:

importsk.p1ro.Updater;
publicclassMainApplicationextendsApplication {
@OverridepublicvoidonCreate() {
super.onCreate();
Updater.init(this);
}
}

Usage

Rolling out updates

After you upload new version to update server users will get notified about new version automatically via notification.

User checks for updates

If you want to allow user to check for updates themselves you can have two options.

Option 1

Install update automatically right after check like this:

Buttonbutton = findViewById(R.id.updateButton);
button.setOnClickListener(e -> UpdateUtil.checkAndInstallUpdate(this))

Option 2

You can control individual step when to do one of update steps :

publicstaticvoidinstallUpdate(Contextcontext) {
checkUpdate(context, shouldInstall -> {
if (shouldInstall) {
// you can display some dialog heredownloadUpdate(context, callback -> {
// you can display some dialog hereinstallUpdate(context);
});
}
});
}

Customization

If you want to translate messages you can do so by overriding following strings in your strings.xml

<stringname="update_check">Checking updates</string> <stringname="update_wait_please">This can take a while…</string> <stringname="update_version">New version %1$s is available</string> <stringname="update_title">Update available</string> <stringname="update_latest_version">You have latest version</string>

About

Update your android apps with ease without any store

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages