Search in sources :

Example 1 with AppUpdateManager

use of com.google.android.play.core.appupdate.AppUpdateManager in project alpha-wallet-android by AlphaWallet.

the class UpdateUtils method pushUpdateDialog.

public static void pushUpdateDialog(Activity context) {
    AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
    Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
    appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
        if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
            appUpdateManager.startUpdateFlow(appUpdateInfo, context, AppUpdateOptions.newBuilder(AppUpdateType.FLEXIBLE).build());
        }
    });
}
Also used : AppUpdateInfo(com.google.android.play.core.appupdate.AppUpdateInfo) AppUpdateManager(com.google.android.play.core.appupdate.AppUpdateManager)

Example 2 with AppUpdateManager

use of com.google.android.play.core.appupdate.AppUpdateManager in project alpha-wallet-android by AlphaWallet.

the class UpdateUtils method checkForUpdates.

public static void checkForUpdates(Activity context, FragmentMessenger messenger) {
    AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
    Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
    appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
        if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
            messenger.updateReady(appUpdateInfo.availableVersionCode());
        }
    });
}
Also used : AppUpdateInfo(com.google.android.play.core.appupdate.AppUpdateInfo) AppUpdateManager(com.google.android.play.core.appupdate.AppUpdateManager)

Example 3 with AppUpdateManager

use of com.google.android.play.core.appupdate.AppUpdateManager in project Ethernity-Wallet-Android by kris-krytech.

the class UpdateUtils method pushUpdateDialog.

public static void pushUpdateDialog(Activity context) {
    AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
    Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
    appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
        if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
            appUpdateManager.startUpdateFlow(appUpdateInfo, context, AppUpdateOptions.newBuilder(AppUpdateType.FLEXIBLE).build());
        }
    });
}
Also used : AppUpdateInfo(com.google.android.play.core.appupdate.AppUpdateInfo) AppUpdateManager(com.google.android.play.core.appupdate.AppUpdateManager)

Example 4 with AppUpdateManager

use of com.google.android.play.core.appupdate.AppUpdateManager in project Ethernity-Wallet-Android by kris-krytech.

the class UpdateUtils method checkForUpdates.

public static void checkForUpdates(Activity context, FragmentMessenger messenger) {
    AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
    Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
    appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
        if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
            messenger.updateReady(appUpdateInfo.availableVersionCode());
        }
    });
}
Also used : AppUpdateInfo(com.google.android.play.core.appupdate.AppUpdateInfo) AppUpdateManager(com.google.android.play.core.appupdate.AppUpdateManager)

Example 5 with AppUpdateManager

use of com.google.android.play.core.appupdate.AppUpdateManager in project play-core-samples by aospstudio.

the class MainActivityJava method initAppUpdateManager.

/* FLEXIBLE or IMMEDIATE */
private void initAppUpdateManager() {
    AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
    appUpdateManager.getAppUpdateInfo().addOnSuccessListener(appUpdateInfo -> {
        if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
            try {
                appUpdateManager.startUpdateFlowForResult(appUpdateInfo, AppUpdateType.FLEXIBLE, this, 2000);
            } catch (IntentSender.SendIntentException e) {
                e.printStackTrace();
            }
        } else if (appUpdateInfo.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
            try {
                appUpdateManager.startUpdateFlowForResult(appUpdateInfo, AppUpdateType.FLEXIBLE, this, 2000);
            } catch (IntentSender.SendIntentException e) {
                e.printStackTrace();
            }
        }
    });
}
Also used : IntentSender(android.content.IntentSender) AppUpdateManager(com.google.android.play.core.appupdate.AppUpdateManager)

Aggregations

AppUpdateManager (com.google.android.play.core.appupdate.AppUpdateManager)5 AppUpdateInfo (com.google.android.play.core.appupdate.AppUpdateInfo)4 IntentSender (android.content.IntentSender)1