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
-
Extend your
Application
class from theApplication
class from the Cheetah Digital Corekit. -
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;
}
- There are two methods in the
UpgradeCheckListener
: -onUpgradeCheckFailed
-onUpgradeCheckSuccess
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.