Recently, Google introduced 'in-app updates' in Google I/O 2019.
So I am trying to use it.
val appUpdateManager = AppUpdateManagerFactory.create(this)
val appUpdateInfo = appUpdateManager.appUpdateInfo
appUpdateInfo.addOnCompleteListener {
val result = it.result
if (result.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
&& result.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
info("should show update")
appUpdateManager.startUpdateFlowForResult(
result,
AppUpdateType.FLEXIBLE,
this,
1)
} else {
info("This is already latest version: ${result.updateAvailability()}")
}
}
But the result.updateAvailability()
is always UpdateAvailability.UPDATE_NOT_AVAILABLE
.
To do this, I made a signed release apk with previous version code. But it doesn't work.
According to the demo on the Developer Keynote (16:40 ~ )
He is doing it with the emulator. It looks like debug mode.
How can I do this same thing?
The right way to test in-app update is to use Internal App Sharing (not to be confused with Internal Testing Track).
./gradlew bundleRelease
or ./gradlew bundle<variant>
.aab
file which is under app/build/outputs/bundle/<variant>/
. Give a decent name that includes version code.build.gradle
and build another bundle. Note: Version code is integer, that's what is to be incremented. Version name is different and it doesn't matter for this.If you don't see the prompt and if you had followed these steps exactly, most likely, there is an issue with your code. Add some logging to see what is happening in your code.
In our testing, the following did NOT help to test in-app updates (which were suggested elsewhere):
Once testing through internal app sharing is successful, I still found some trouble testing in-app update through published versions. After some trials, I was able to successfully test through Alpha track. I'm adding the steps here (I'm assuming you're familiar with Google Play console's Alpha closed track and adding yourself as alpha tester list):
I guess similar process should work for Beta (open track) and production tracks as well.
Even after the update is available through Google Play, for the end-users to see in-app update, I think it may take quite some time (days!). Google Play has its own confusing ways. Good luck.