Reputation: 174
I have integrated app update feature with google play core library version -
implementation 'com.google.android.play:core:1.6.3'
I am checking for new update as-
public void checkforUpdate(){
appUpdateManager.getAppUpdateInfo().addOnSuccessListener(
appUpdateInfo -> {
// Checks that the platform will allow the specified type of update.
if ((appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE)
&& appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE))
{
// Request the update.
try {
appUpdateManager.startUpdateFlowForResult(
appUpdateInfo, AppUpdateType.IMMEDIATE, this,REQUEST_APP_UPDATE);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
}
});
}
But this code returns as no update available even if a new version application is available on the play store. In a few mobile phones if I clear the cache of the play store then this part of code is able to detect a new version of the update but not in all mobiles.
Please suggest me some solution to fix this problem. Thanks in Advance.
Upvotes: 0
Views: 5562
Reputation: 1825
There is some issue in an IMMEDIATE update. this bug also submitted. For now, you can use the flexible update feature it's working properly.
See the below link.
[In-App Update gives InstallException (ERROR_API_NOT_AVAILABLE)
And also use the latest core dependencies.
implementation 'com.google.android.play:core:1.7.2'
Upvotes: 1