Class AppUpdates
Checks whether a newer version of the app is in the store and helps the user install it.
On Android the check uses Google Play in-app updates, which the build adds
when this class is referenced. #startUpdate(boolean) then shows Play's
own flexible or immediate update flow. Everywhere else the check asks the
App Store lookup service for the version published under the bundle id,
and #startUpdate(boolean) opens the store page.
AppUpdates.check(new SuccessCallback<AppUpdates.UpdateInfo>() {
public void onSucess(AppUpdates.UpdateInfo info) {
if (info.isUpdateAvailable()) {
AppUpdates.startUpdate(false);
}
}
});
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA platform update service.static final classThe result of#check(SuccessCallback). -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheck(SuccessCallback<AppUpdates.UpdateInfo> callback) Checks for a newer version.static intcompareVersions(String a, String b) Compares two dotted version strings numerically.static voidsetProvider(AppUpdates.Provider provider) Registers the platform provider.static booleanstartUpdate(boolean immediate) Starts the update: Play's update flow on Android, or the store page that an earlier#check(SuccessCallback)found.
-
Method Details
-
setProvider
Registers the platform provider. Internal: for ports and generated code, which inject the platform implementation here; applications do not call it.
Parameters
provider: the provider, or null for the store lookup
-
check
Checks for a newer version. The callback is called on the EDT; on a failure it gets an
UpdateInfowith no update and no version.Parameters
callback: receives the result
-
startUpdate
public static boolean startUpdate(boolean immediate) Starts the update: Play's update flow on Android, or the store page that an earlier
#check(SuccessCallback)found.Parameters
immediate: on Android, true for Play's blocking flow; ignored elsewhere
Returns
true when a flow or store page was opened
-
compareVersions
-