I have an Android app released on PlayStore.
In general, when I release a new version to the PlayStore, I set the 'user fraction' to 30%.
Then, I will monitor it for a few days and if there are no major problems, I will gradually increase it and deploy it to 100%.
I do this on the PlayConsole Web site.
But I want to do this programmatically.
So I found the API and created a Python code.
args = argparser.parse_args()
user_fraction = args.user_fraction
credentials = ServiceAccountCredentials.from_json_keyfile_name('key.json', 'https://www.googleapis.com/auth/androidpublisher')
http = httplib2.Http()
http = credentials.authorize(http)
service build('androidpublisher', 'v3', http=http)
# get edit id
edit_request = service.edits().insert(body={}, packageName=package_name)
result = edit_request.execute()
edit_id = result['id']
print('edit id: %s' % edit_id)
result = service.edits().tracks().patch(
editId=edit_id,
packageName=package_name,
track="production",
body={
"releases": [
{
"versionCodes": [ target_code ],
"userFraction": 0.4,
"status": "inProgress"
}
]
}
).execute()
println(result)
When I run this code, it prints below response:
{
"track": "production",
"releases": [
{
"versionCodes": [ xxx ],
"status": "inProgress",
"userFraction": 0.4
}
]
}
The userFraction was changed! But when I open the PlayConsole, the User fraction doesn't change. It still 30%.
Why the web page is still showing 0.3? Is this a caching issue?
I found the cause and solution.
I missed the extra function call.
I should call
committoo!After this call, it works fine!