Describes the Android update SDK API, including version check methods and upgrade callback methods.
Describes the Android update SDK API, including version check methods and upgrade callback methods.
MPaaSCheckVersionService API
MPaaSCheckVersionService provides methods to initiate version checks, configure check frequency, register a callback, and trigger APK download and installation.
checkNewVersion
Checks whether a new version is available. Launches an asynchronous task that calls the appropriate MPaaSCheckCallBack callback method regardless of the result.
void checkNewVersion(Activity activity)
setIntervalTime
Sets the minimum interval between repeated version checks, in milliseconds. Defaults to 3 days.
When checkNewVersion is called before this interval has elapsed, the SDK skips the network check and triggers MPaaSCheckCallBack.onLimit instead. This applies only when the configuration is set to Single reminder.
void setIntervalTime(long interval202)
setMPaasCheckCallBack
Registers the callback instance that receives version check results.
void setMPaaSCheckCallBack(MPaaSCheckCallBack mPaaSCheckCallBack)
installApk
Installs the downloaded APK. Call this method inside MPaaSCheckCallBack.alreadyDownloaded when the user confirms installation.
void installApk(String filePath)
void installApk(ClientUpgradeRes res)
update
Starts downloading the new version APK. Call this method inside MPaaSCheckCallBack.showUpgradeDialog when the user confirms the upgrade.
void update(ClientUpgradeRes res)
MPaaSCheckCallBack API
MPaaSCheckCallBack is the callback interface you implement to handle version check results. The SDK calls these methods in the following sequence depending on the result:
startCheck— check initiatedOne of:
isUpdating,onException,dealDataInValid,dealHasNoNewVersion,alreadyDownloaded,showUpgradeDialog, oronLimit
startCheck
Called immediately after checkNewVersion initiates a version check. Use this method to show a loading indicator to the user.
void startCheck()
isUpdating
Called when checkNewVersion is invoked while a version check is already in progress.
void isUpdating()
onException
Called when the version check fails due to an exception. Use the throwable parameter to log or display the error.
void onException(Throwable throwable)
dealDataInValid
Called when the server returns version data that cannot be parsed or is otherwise invalid. The result parameter contains the raw response for diagnostic purposes.
void dealDataInValid(Activity activity, ClientUpgradeRes result)
dealHasNoNewVersion
Called when the server confirms no new version is available. Use this method to dismiss the loading indicator or notify the user.
void dealHasNoNewVersion(Activity activity, ClientUpgradeRes result)
alreadyDownloaded
Called when a new version is available and its APK has already been downloaded to the device. Prompt the user to install the package. If the user confirms, call MPaaSCheckVersionService.installApk.
void alreadyDownloaded(Activity activity, ClientUpgradeRes result)
showUpgradeDialog
Called when a new version is available but the APK has not been downloaded. Show a dialog box asking whether the user wants to upgrade. If the user confirms, call MPaaSCheckVersionService.update to start the download.
void showUpgradeDialog(Activity activity, ClientUpgradeRes result)
onLimit
Called when a new version is available but the interval set by MPaaSCheckVersionService.setIntervalTime has not elapsed since the last check. Valid only when the configuration is set to Single reminder.
void onLimit(Activity activity, ClientUpgradeRes result, String reason)