Cheetah CES Docs Portal

Navigation
Home
GitHub
Email
Corporate Site


Upgrade Check

« Back to Kits References

Overview

The Upgrade Check kit verifies whether the user needs to do a Required or a Suggested App upgrade. You can query the Upgrade Action via UpgradeCheckAPI’s upgradeCheck method. A specific action will then be returned when this API call is successful.

To include the Upgrade Check kit, open the Gradle Scripts | build.gradle (Module: app) and add the following to the dependencies section:

   implementation 'com.cheetahdigital.android:upgradecheck:<version>'

The different upgrade check actions that can be received are the following:

  • NO_ACTION
  • REQUIRED_UPGRADE
  • SUGGESTED_UPGRADE

How To Implement

  1. Extend your Application class from the Application class from the Cheetah Digital Corekit.

  2. Override the getUpgradeCheckListener method

 @Override
    public LifeCycleHandler.UpgradeCheckListener getUpgradeCheckListener() {
        if (mUpgradeCheckListener == null) {
            mUpgradeCheckListener = new UpgradeCheckListener() {
                @Override
                protected void onUpgradeCheckFailed(String error) {
                    // Log error
                    Log.d("Upgrade Check", error);
                }
            };
        }
        return mUpgradeCheckListener;
    }
  1. There are two methods in the UpgradeCheckListener: - onUpgradeCheckFailed - onUpgradeCheckSuccess
By default there is an implementation for onUpgradeCheckSuccess - this will parse the API response and will either show the following: - REQUIRED_UPGRADE - non-cancellable dialog with action button that will redirect to the Play Store - SUGGESTED_UPGRADE - cancellable dialog with action buttons cancel and go to Play Store As for onUpgradeCheckFailed, we suggest not to add any implementation here but if you want to send out logs to your logger it can be done here.


« Back to Kits References