Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class AppUpdates

  1. Object
  2. 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 types

class AppUpdates.UpdateInfoThe result of #check(SuccessCallback).
interface AppUpdates.ProviderA platform update service.

Methods

public static void setProvider(AppUpdates.Provider provider)Registers the platform provider.
public static void check(SuccessCallback<AppUpdates.UpdateInfo> callback)Checks for a newer version.
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.
public static int compareVersions(String a, String b)Compares two dotted version strings numerically.

Inherited methods

Method details

setProvider

public static void setProvider(AppUpdates.Provider provider)
Registers the platform provider. Internal: for ports and generated code, which inject the platform implementation here; applications do not call it.

Parameters

provider AppUpdates.Provider
the provider, or null for the store lookup

check

public static void check(SuccessCallback<AppUpdates.UpdateInfo> callback)
Checks for a newer version. The callback is called on the EDT; on a failure it gets an UpdateInfo with no update and no version.

Parameters

callback SuccessCallback<AppUpdates.UpdateInfo>
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 boolean
on Android, true for Play’s blocking flow; ignored elsewhere

Returns

true when a flow or store page was opened

compareVersions

public static int compareVersions(String a, String b)
Compares two dotted version strings numerically.

Parameters

a String
a version such as 1.10.2
b String
another version

Returns

a negative number, zero or a positive number as a is older, equal or newer than b