Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 266
SANAT Avatar asked Jun 24 '19 11:06

SANAT


People also ask

How does app update work?

In-app updates is a Google Play Core libraries feature that prompts active users to update your app. The in-app updates feature is supported on devices running Android 5.0 (API level 21) or higher. Additionally, in-app updates are only supported for Android mobile devices, Android tablets, and Chrome OS devices.

How do I change my app priority update?

To determine priority, Google Play uses an integer value between 0 and 5, with 0 being the default and 5 being the highest priority. To set the priority for an update, use the inAppUpdatePriority field under Edits.


1 Answers

What is the use of appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)?

This is a very common question.

Many (myself included) interpreted this as a value that could be set somewhere dynamically, e.g. in the Google Play Console.

However that appears to not be the case. This is a local check that determines whether conditions on the device have been met to show the dialog.

If you want to dynamically configure whether to show Immediate or Flexible updates, you will need to provide it yourself, e.g. from your backend.

For more info: https://medium.com/@jplipata/undocumented-android-in-app-updates-a95efb9b7bd8?source=friends_link&sk=e8085150daa555ea80d07e8419b5341e

like image 103
tenprint Avatar answered Oct 02 '22 09:10

tenprint