All Products
Search
Document Center

API

Last Updated: Feb 04, 2021

Learn about how to use the relevant APIs of Android update SDK.

MPaaSCheckVersionService API

checkNewVersion

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.

 
  1. void checkNewVersion(Activity activity)

setIntervalTime

Set the interval of reminder:

 
  1. void setIntervalTime(long interval202)

3 days by default, in milliseconds.

setMPaasCheckCallBack

An example of the callback to be called when setting the update SDK for checking updates:

 
  1. void setMPaaSCheckCallBack(MPaaSCheckCallBack mPaaSCheckCallBack)

installApk

To install the package of the new version, in MPaaSCheckCallBack.alreadyDownloaded method, you can call:

 
  1. void installApk(String filePath)
  2. void installApk(ClientUpgradeRes res)

update

To download the package of the new version, in MPaaSCheckCallBack.showUpgradeDialog method, you can call:

 
  1. void update(ClientUpgradeRes res)

MPaaSCheckCallBack API

startCheck

Called after calling the update checking interface. In this method, you can prompt the users that the checking is in loading:

 
  1. void startCheck()

isUpdating

Called when the update checking interface is repeatedly called:

 
  1. void isUpdating()

onException

Called when exceptions occur in update checking:

 
  1. void onException(Throwable throwable)

dealDataInValid

Called if the returned update information is valid:

 
  1. void dealDataInValid(Activity activity, ClientUpgradeRes result)

dealHasNoNewVersion

Called if the returned update information is invalid:

 
  1. void dealHasNoNewVersion(Activity activity, ClientUpgradeRes result)

alreadyDownloaded

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:

 
  1. void alreadyDownloaded(Activity activity, ClientUpgradeRes result)

showUpgradeDialog

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:

 
  1. void showUpgradeDialog(Activity activity, ClientUpgradeRes result)

onLimit

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.

 
  1. void onLimit(Activity activity, ClientUpgradeRes result, String reason)