abhijith em
abhijith em

Reputation: 491

How to set update priority for a new android release

I have been trying to implement the Google’s new in-app updates and I am stuck at a point. The issue is first, how can the developer specify the type of update i.e. flexible or immediate while releasing a new update of the app. Secondly, if it's for the developer to decide which type of update he has to implement for a specific update then what is the use of – appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE) or appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.Flexible)

it is given in the documentation that 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 inAppUpdatePriority field under Edits.tracks.releases in the Google Play Developer API. how to set it?

Upvotes: 47

Views: 19042

Answers (7)

Kunal Mathur
Kunal Mathur

Reputation: 59

Warning This method only works out if you have not start rollout to production of the updated version code bundle

I found a way for doing it manually

Step 1. Generate a access Toekn Key for your account by following this tutorial

https://codeible.com/view/videotutorial/EUVd83616z4AppnnKk4Y;title=Generating%20the%20JWT%20and%20Retrieving%20the%20OAuth%202.0%20Token

Step 2. Copy the access token The access token will be of this type

"ya29.c.b0AUFJQsGvVWO8VYxKHVlS-VzF-A4f5RvwIhXww8xYq6TAB-oCgMTOoDPG9pgQGjfXe-nNogus5q1fjovSB1mNeNTIPFXCq4Hfd3pUZEuYrNoyB3bf-twLIMdV-p_c7vAv_aAfjHUzKdKXSlFSrV1_Gdi-TEnoV-RnOEqKA3szGTGMRfWx2GCR34MuhAxUJFVUl7h4V7r8ad3gXMjYh912IPzEfec4G0o........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", copy this for authorization

Step 3. Do a POST Request on Postman of the following url

https://androidpublisher.googleapis.com/androidpublisher/v3/applications/your_package_name/edits

See image for how to set up header for authorization

https://i.sstatic.net/06TxY.png

Step 4. Do a PUT Requestion on Postman of the following url and copy the edit number generated from step 3

https://androidpublisher.googleapis.com/androidpublisher/v3/applications/packagename/edits/generated_edit_number/tracks/production

See image for how to set up body for specifying the version code and update priority and put same heaader as done in step-3

https://i.sstatic.net/VpH1w.png

Step 5. Finally do a POST Request of the following url with the same headers as
mentioned in step 3

https://androidpublisher.googleapis.com/androidpublisher/v3/applications/packagename/edits/generated_edit_number:commit

Upvotes: 1

Levent YADIRGA
Levent YADIRGA

Reputation: 45

Using the version code, a decision can be made about the update. Example: forced update if version code is even number, flexible update if odd number.

Upvotes: 2

Serge Mastaki
Serge Mastaki

Reputation: 13

I explain how I was able to set inAppUpdatePriority to 5.

  1. Create an internal release without deploying it to internal testers. Thus, its status is draft.
  2. Install the Google APIs Client Library for Python as explained here: https://github.com/googlesamples/android-play-publisher-api/tree/master/v3/python
  3. Use the following code and edit it to match your need:
import argparse
import sys
from apiclient import sample_tools
from oauth2client import client
import json

TRACK = 'internal'

# Declare command-line flags.
argparser = argparse.ArgumentParser(add_help=False)
argparser.add_argument('package_name',
                       help='The package name. Example: com.android.sample')


def main(argv):
  # Authenticate and construct service.
  service, flags = sample_tools.init(
      argv,
      'androidpublisher',
      'v3',
      __doc__,
      __file__,
      parents=[argparser],
      scope='https://www.googleapis.com/auth/androidpublisher')

  # Process flags and read their values.
  package_name = flags.package_name

  try:

    edit_request = service.edits().insert(body={}, packageName=package_name)
    result = edit_request.execute()
    edit_id = result['id']

    tracks_result = service.edits().tracks().list(
        editId=edit_id, packageName=package_name).execute()
    
    track_release = None
    for release in tracks_result["tracks"]:
      if release["track"] == TRACK:
        track_release = release
    
    release_data = track_release["releases"][0]
    release_data["inAppUpdatePriority"] = 5
    track_response = service.edits().tracks().update(
        editId=edit_id,
        track=TRACK,
        packageName=package_name,
        body={u'releases': [release_data]}).execute()
    print(json.dumps(track_response,sort_keys=True, indent=2))

    commit_request = service.edits().commit(
        editId=edit_id, packageName=package_name).execute()

  except client.AccessTokenRefreshError:
    print ('The credentials have been revoked or expired, please re-run the '
           'application to re-authorize')

if __name__ == '__main__':
  main(sys.argv)

You should save it an filename.py.

  1. After installing all dependencies and giving required permissions, launch it as (com.android.sample is your package name):
python filename.py com.android.sample

Upvotes: 0

Ashraf Amin
Ashraf Amin

Reputation: 421

Here is the Google official guides https://developers.google.com/android-publisher/api-ref/rest/v3/edits.tracks/update

But i don't know how to run the API.

What are the parameters "editId" & "track" ? And what is the "Authorization Scopes" ?

Google really need to improve their documentation skills to make it crystal clear for developer like us

enter image description here

Upvotes: 9

Sujith Chandran
Sujith Chandran

Reputation: 2721

Using the combination of Firebase remote config and Android in app update seems to work well.

Please follow the tutorial here for reference : https://engineering.q42.nl/android-in-app-updates/

Upvotes: 7

kuzdu
kuzdu

Reputation: 7524

I can recommend the https://github.com/Triple-T/gradle-play-publisher

Then you can set your prio in your gradle.

play {
 // Overrides defaults
 track.set("production")
 userFraction.set(0.5)
 updatePriority.set(2)
 releaseStatus.set(ReleaseStatus.IN_PROGRESS)
}

Upvotes: 5

MrinmoyMk
MrinmoyMk

Reputation: 603

Priority for app update can be set using Play Developer Publishing API's ⁠Edits methods. Currently there is no way to set it using Play Console but there is a plan to integrate in Play Console. Please look at this for more help, you will also find other helpful notes in this link. Hope it may help you

Upvotes: 30

Related Questions