Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android In-app updates, where should i set update type?

From where I can set app update type(IMMEDIATE/FLEXIBLE)? I can not find it in playstore console.

From where this code knowing available update type?

 // Creates an 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.
    }
});
like image 927
Sergey Avetisyan Avatar asked Sep 17 '19 05:09

Sergey Avetisyan


1 Answers

We need to call this: PUT API

https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/edits/{editId}/tracks/{track}

Pass data in body:

{
  "releases": [{
      "versionCodes": ["12"],
      "inAppUpdatePriority": 5,
      "status": "completed"
  }]
}

To determine priority, Google Play uses an integer value between 0 and 5, with 0 being the default, and 5 being the highest priority. For example, consider the following strategy for setting update priority:

  • Minor UI improvements: Low-priority update; request neither a flexible nor immediate update.
  • Performance improvements: Medium-priority update; request a flexible update.
  • Critical security update: High-priority update; require an immediate update.

For Full info you can refer to below links:

https://developer.android.com/guide/playcore/in-app-updates#:~:text=In%2Dapp%20updates%20is%20a,0%20or%20higher.

https://developers.google.com/android-publisher/api-ref/rest/v3/edits.tracks/update

like image 68
Sanjayrajsinh Avatar answered Oct 29 '22 17:10

Sanjayrajsinh