Android SDK

The App Upgrade Android SDK helps you easily integrate with the App Upgrade service. The SDK communicates with App Upgrade and checks your app version against the version information configured in App Upgrade. Based on the response, it will:

  • Show a non-dismissable update popup when the app requires a forced update. When the user taps it, the SDK opens the app store so the user can update.
  • Show a dismissable update popup when the app should be updated but the update is not mandatory.
  • Do nothing when no action is required.

Installation

  • Install via gradle Add the JitPack repository to your settings.gradle file
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        ...
        maven { url "https://jitpack.io" }
    }
}

If you are using gradle version prior to 7.x.x add the following in your root build.gradle at the end of repositories:

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

How to use?

  • Follow the Getting Started guide to create project and get the x-api-key.

  • Add the dependency to your project.

dependencies {
  implementation 'com.github.appupgrade-dev:app-upgrade-android-sdk:1.0.3'
}
  • Internet Permission required. Add the following in AndroidManifest.xml file if not already present.
<uses-permission android:name="android.permission.INTERNET" />
  • If you are using minifyEnabled true it may obfuscate the code. Add the following rule in proguard-rules.pro to make sure SDK shows the popup.
# Keep all classes in the App Upgrade SDK package
-keep class com.appupgrade.app_upgrade_android_sdk.** { *; }
  • Integrate with your app.

Add the following code in your MainActivity.java -> onCreate method.

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // App Upgrade
        String xApiKey = "ZWY0ZDhjYjgtYThmMC00NTg5LWI0NmUtMjM5OWZkNjkzMzQ5";

        String appId = "com.android.com";
        String appName = "Wallpaper app";
        String appVersion = "1.0.0";
        String platform = "android";
        String environment = "production";
        String appLanguage = "es"; //Nullable

        AppInfo appInfo = new AppInfo(appId, appName, appVersion, platform, environment, appLanguage);

        // Optional
        String title = "Update Required.";
        String updateButtonTitle = "UPDATE";
        String laterButtonTitle = "Not Now";
        AlertDialogConfig alertDialogConfig = new AlertDialogConfig(title, updateButtonTitle, laterButtonTitle);

        AppUpgrade appUpgrade = new AppUpgrade();
        appUpgrade.checkForUpdates(this, xApiKey, appInfo, alertDialogConfig);
    }
}

Note:

  1. For opening the Google Play Store the app should be live.
  2. It might not be able to open the Google Play Store in simulator. You can try it in physical device.
  3. You can find a sample Java app from here app-upgrade-android-java-demo-app
  4. Read detailed blog on how to integrate Java app from here How to upgrade/force upgrade Android Java app

Fields

  • appId: App Id of your app. Know how to find appId for your app. (Required)
  • appName: Your app name. (Required)
  • appVersion: Version of your app. (Required)
  • platform: This could be android or ios (Required)
  • environment: This could be for example development, int, production (Required)
  • appLanguage: This is your app language. Example: en, es etc. This will be used to localize the update message. (Optional)

Customizing the Alert popup

You can optionally pass the alertDialogConfig object to customize the alert popup.

  • title: Main title shown to user.
  • updateButtonTitle: Update button title shown to user.
  • laterButtonTitle: Later button title shown to user.

Redirect user to store other than App Store or Google Play Store.

Supported Stores :
Apple App Store Google Play Store Amazon Appstore Huawei AppGallery Other Android Markets
If your app marketplace is not one of these, you can pass your own store URL.

If you want users to redirect to store other than App Store or Google Play Store. You can add these additional parameters preferredAndroidMarket.

  • preferredAndroidMarket: PreferredAndroidMarket.AMAZON // or PreferredAndroidMarket.HUAWEI or PreferredAndroidMarket.OTHER If not provided default is Google Play Store. If the SDK cannot open the preferred marketplace because it is not available, the default Google Play Store listing will open.
  • otherAndroidMarketUrl: 'https://someotherandroidmarket.com/app/id'// Required if preferredAndroidMarket is Other.

Example:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // App Upgrade
        String xApiKey = "ZWY0ZDhjYjgtYThmMC00NTg5LWI0NmUtMjM5OWZkNjkzMzQ5";

        String appId = "com.android.com";
        String appName = "Wallpaper app";
        String appVersion = "1.0.0";
        String platform = "android";
        String environment = "production";
        String appLanguage = "es"; //Nullable
        String preferredAndroidMarket: PreferredAndroidMarket.AMAZON // or PreferredAndroidMarket.HUAWEI or PreferredAndroidMarket.OTHER
        String otherAndroidMarketUrl: 'https://someotherandroidmarket.com/app/id'// Required if preferredAndroidMarket is Other.

        AppInfo appInfo = new AppInfo(appId, appName, appVersion, platform, environment, appLanguage);

        // Optional
        String title = "Update Required.";
        String updateButtonTitle = "UPDATE";
        String laterButtonTitle = "Not Now";
        AlertDialogConfig alertDialogConfig = new AlertDialogConfig(title, updateButtonTitle, laterButtonTitle);

        AppUpgrade appUpgrade = new AppUpgrade();
        appUpgrade.checkForUpdates(this, xApiKey, appInfo, alertDialogConfig);
    }
}

Screenshot

forceupgrade_android_kotlin

Changelog

Please see CHANGELOG for more information what has changed recently.

Need help?

If you're looking for help, please write to us at support@appupgrade.dev

© 2022-2026 | App Upgrade | All Rights Reserved            Updated 2026-07-13 14:43:44

results matching ""

    powered by

    No results matching ""