Recently, Google introduced \'in-app updates\' in Google I/O 2019.
So I am trying to use it.
val appUpdateManager = AppUpdateManagerFactory.create(th
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.
I don't know if by this time you already got it down, but after some time testing I figured out that decreasing the versionName
is what I needed to do to be able to test it properly, before I'd tested only decreasing the versionCode
...
I think that the API should be able to handle whenever the versionName
or versionCode
are out of date, but apparently it doesn't.
Take a look at documentation of FakeAppUpdateManager
or try below pre-defined method will help you to test app update available or not.
FakeAppUpdateManager fakeAppUpdateManager = new FakeAppUpdateManager(this);
fakeAppUpdateManager.setUpdateAvailable(1); // add app version code greater than current version.
fakeAppUpdateManager.getAppUpdateInfo().addOnSuccessListener(new OnSuccessListener<AppUpdateInfo>() {
@Override
public void onSuccess(AppUpdateInfo appUpdateInfo) {
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
&& appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
System.out.println("checkForAppUpdateAvailability");
}
}
});
Hmm... I found the solution. It is not the same as the demo on the Google I/O 2019 - Developer Keynotes.
I published the signed release apk into the internal developer version. And it works fine.
Or you can publish it on the "Alpha/Beta close test publish".
For me, the last step of the Troubleshoot section in the docs made it work!
Basically, after you change the version of the app (version name and code), do this:
Make sure the account is eligible and the Google Play cache is up to date. To do so, while logged into the Google Play Store account on the test device, proceed as follows:
Make sure you completely close the Google Play Store App.
Open the Google Play Store app and go to the My Apps & Games tab.
If the app you are testing doesn’t appear with an available update, check that you’ve properly set up your testing tracks.
Alternatively you can use this class as a UNIT test for simulation of in-app updates
FakeAppUpdateManager
This has some pre-defined methods.