I am trying to integrate the new In-App Update API but I cannot able to test it's implementation. Seems like my code is fine therefore I read the Troubleshoots and am not able to understand 2 points in this document
Make sure that the app that you are testing is signed with the same signing key as the one available from Google Play.
If the app you are testing doesn’t appear with an available update, check that you’ve properly set up your testing tracks.
Anyway I just want to test on my device and I decremented the version code from the play store version but its showing always UPDATE_NOT_AVAILABLE
.
Here is code:-
val appUpdateInfo: Task<AppUpdateInfo> = appUpdateManager.appUpdateInfo
appUpdateInfo.addOnSuccessListener {
if (it.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && it.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
appUpdateManager.startUpdateFlowForResult(it, AppUpdateType.FLEXIBLE, this, 2);
}else{
toast("Not Available")
}
}
Use internal app sharing to test in-app updates by performing the following steps: Make sure your test device has a version of your app installed that supports in-app updates and was installed using an internal app sharing URL. Follow the Play Console instructions to share your app internally.
To determine priority, 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 the inAppUpdatePriority field under Edits.
Internal App Sharing is not working on a real device. I was testing several hours and always got the latest version of Internal Test and not the one of Interal App Sharing that was what I expected.
I describe the step by step:
APK 1: versionCode and versionName: 100
APK 2: versionCode and versionName: 101
Upload APK 1 to internalappsharing with versionCode and versionName 100
Copy and paste the shared link of APK 1 into Keep Notes web app.
Finally, each time they enter a link with a version code greater than the last installed from the emulator they will see the existence of a new update, which should be installed within the app and not from the Play Store.
It is worth mentioning that Logcat is compatible with Internal App Sharing.
GL
Source
As of today, in-app-update testing can not be done for a debug build. You don't need to put your apk to PlayStore to test also. The best way to test in-app-update
is by using internal-app-sharing
.
If you follow the below steps one-by-one, you'll be able to test successfully.
in-app-update
testing in your device, https://developer.android.com/guide/playcore/in-app-updates#internal-app-sharing
Here, I'll be writing the same in easy words.
Once you're done with setting up internal-app-sharing
in Play-Store
, make sure that you have to upload 2 apks to internal-app-sharing on Play-Console
and hence generate 2 links. Both apks will be signed using the same signing-key
(need not be the same as the one you use to sign for production, any dummy signing-key would work).
To know, How to upload apk to internal-app-sharing on Play-Console, follow this lisk, https://support.google.com/googleplay/android-developer/answer/9844679?visit_id=637437125318137239-1277036129&rd=1
NOTE: make sure, you have uninstalled any preinstalled app with the same package-name in your device.
NOTE: Before installing, make sure the email-id you're using on play-store has been added in the mail-list on internal-app-sharing on play-console.
Now, once you've installed the app using the link. Now, you need to again create a new signed apk with higher VersionCode (say, 101). And upload this apk to internal-app-sharing.
Now, copy the link with higher VersionCode from internal-app-sharing. Click on this link on your device, it will take you to play-store but this time, update
button will be enabled rather than install
button as app is already installed in your device with lower VersionCode.
You don't have to click the update button on PlayStore. You just have to click the link and hence open the screen on PlayStore. Now close PlayStore app.
Now, you can launch the already installed app from your device.
If your implementation of in-app-update is fine, launching the app would appear the dialog from PlayStore for update.
Lastly, don't forget to upvote if it helps you in any way. Keep Coding!
I struggled with this same problem for a few days before once again going through the documentation thoroughly. Read this section on the official documentation of the in-app updates.
The link describes the correct testing procedure as follows:
- On your test device, make sure you've already installed a version of your app that meets the following requirements:
- Follow the Play Console instructions on how to share your app internally. Make sure you upload a version of your app that uses a version code that's higher than the one you have already installed on the test device.
- On the test device, only click the internal app-sharing link for the updated version of your app. Do not install the app from the Google Play Store page you see after clicking the link.
- Open the app from the device's app drawer or home screen. The update should now be available to your app, and you can test your implementation of in-app updates.
This is also super helpful because you don't have to wait for the app to be published, you can start testing immediately.
I had the similar issue of having UPDATE_NOT_AVAILABLE. After hours of researching, here is how i solved:
use Google play store to install a version of the testing app (I used internal test track rollout)
rollout another version with higher VERSION CODE on Play Console (the same internal test track)
close both testing app and Google play store (not just back to home, use recent key and swipe them off)
open the Google play store and ensure that testing app has an update available (you can check it under "My Apps & Game" > Installed)
now open the testing app and check for UPDATE_AVAILABLE
This works for me almost immediately after rollout
Basic Requirements for Manual Testing
In order to manually perform the full update flow on the test device, you should have at least two versions of the app with the different version number: a source version and a target version.
Update is Not Available ERROR
First of all, please double-check the requirements mentioned above. If you successfully complete above listed steps in compliance with all requirements and still getting the error then please pay attention to the following trick. The most likely reason is that the Google Play app does not know about the update yet due to the internal caching mechanism. To make sure you have the cache fresh when testing manually you can refresh the cached version by going to the My Apps & Games screen in the Google Play app. Other, alternative, you can simply clear the cache of the Google Play app in the settings. Note that this is just an issue for testing and does not affect end users since the cache is updated daily anyway.
Note - App Bundle is not mandatory for IAUs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With