Learn about how to use the relevant APIs of Android update SDK.
Check if a new version is available. This method starts an asynchronous task to check the updates and calls the relevant callback method of
MPaaSCheckCallBack whether or not a new version is available.
void checkNewVersion(Activity activity)
Set the interval of reminder:
void setIntervalTime(long interval202)
3 days by default, in milliseconds.
An example of the callback to be called when setting the update SDK for checking updates:
void setMPaaSCheckCallBack(MPaaSCheckCallBack mPaaSCheckCallBack)
To install the package of the new version, in
MPaaSCheckCallBack.alreadyDownloaded method, you can call:
void installApk(String filePath)
void installApk(ClientUpgradeRes res)
To download the package of the new version, in
MPaaSCheckCallBack.showUpgradeDialog method, you can call:
void update(ClientUpgradeRes res)
Called after calling the update checking interface. In this method, you can prompt the users that the checking is in loading:
Called when the update checking interface is repeatedly called:
Called when exceptions occur in update checking:
void onException(Throwable throwable)
Called if the returned update information is valid:
void dealDataInValid(Activity activity, ClientUpgradeRes result)
Called if the returned update information is invalid:
void dealHasNoNewVersion(Activity activity, ClientUpgradeRes result)
Called if the new version package has already been downloaded: You can prompt users to install this package at this time. If users choose to install, then
MPaaSCheckVersionService.installApk method is called for installation:
void alreadyDownloaded(Activity activity, ClientUpgradeRes result)
Called when a new version is available, but the package is not downloaded. You can prompt and ask users whether to update, if users choose to update, then
MPaaSCheckVersionService.update method is called for triggering download:
void showUpgradeDialog(Activity activity, ClientUpgradeRes result)
Called when a new version is available, but the time from the last checking is less than the set interval. It is valid only when the configuration is Single reminder.
void onLimit(Activity activity, ClientUpgradeRes result, String reason)