Thursday, 27 June 2019

In-app updates check whether it is AppUpdateType.FLEXIBLE or AppUpdateType.IMMEDIATE

Is there any option available in the playstore console to configure this value?

Here is the official doc. code:

// Creates instance of the manager.
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);

// Returns an intent object that you use to check for an update.
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();

// Checks that the platform will allow the specified type of update.
appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
    if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
          // For a flexible update, use AppUpdateType.FLEXIBLE
          && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
              // Request the update.
    }
});

How do we know about:

appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)

Where to configure the above type? There is no relevant description available on the official doc.

In the AppUpdateInfo.class:

public final boolean isUpdateTypeAllowed(int var1) {
        if (var1 == 0) {
            return this.f != null;
        } else if (var1 == 1) {
            return this.e != null;
        } else {
            return false;
        }
    }

Where f and e are the PendingIntent and method returns true or false based on their value.



from In-app updates check whether it is AppUpdateType.FLEXIBLE or AppUpdateType.IMMEDIATE

No comments:

Post a Comment