Version upgrade code examples
Android code example
To see how this feature looks and interacts on a mobile device, download the Android code example. Compile the bundle in Android Studio and install the .apk file on your Android mobile device. For more information, see the Android code example.
iOS code example
Check for upgrades
When you call the upgrade check API, mPaaS connects to the mPaaS publishing service in the background to check for new versions. If a new version is available, a default upgrade window appears automatically. Click Upgrade to start the upgrade. No additional code is required. To create a custom upgrade prompt window, see the instructions below.
- (void)checkUpdate
{
UpgradeCheckService *service = [UpgradeCheckService sharedService];
service.delegate = self;
[service checkUpgradeAndShowAlertWith:YES];
}When you add the software development kit (SDK), a dependency on the publishing service gateway is automatically added: mPaaS > Targets > MPHttpClient > DTRpcInterface+upgradeComp.m. Therefore, you only need to call the checkUpgradeAndShowAlertWith method. The publishing component automatically connects to the publishing service in the background.
Customize the upgrade prompt UI
You can implement a delegate to customize the upgrade check UI.
# pragma mark UpgradeViewDelegate
- (UIImage *)upgradeViewHeader
{
return [UIImage imageNamed:@"FinancialCloud"];
}
- (void)showProgressHUD:(BOOL)animation
{
self.toast = [APToastView presentToastWithin:self.view withIcon:APToastIconLoading text:nil];
}
- (void)hideProgressHUD:(BOOL)animation
{
[self.toast dismissToast];
}
- (void)showToastViewWith:(NSString *)message duration:(NSTimeInterval)timeInterval
{
[self showAlert:message];
}