I have implemented Google's library for providing In-App updates
and I am able to receive In-App updates
from Google Play store. I want to implement both Immediate update
and Flexible update
in a single app. But I can't find a way to do so. In-App update library performs a check based on on the VersionCode which is just an Integer. Is there any way I can build a strategy to decide whether to go with Flexible or Immediate Update?
So, they have heard us and they are soon coming up with the solution as heard from Android Dev Summit '19.
Problem:
appUpdateManager.appUpdateInfo.addOnSuccessListener{ info ->
if(info.updateAvailability == UpdateAvailability.UPDATE_AVAILABLE){
// Which trigger should I trigger: Flexible or Immediate
}
}
As developers, we have 2 signals to decide our strategy:
1. Priority Signal: represents how important an update is. The priority value is defined by us while making a release. This priority value is then exposed to our app via Play Core Api.
Example:
appUpdateManager.appUpdateInfo.addOnSuccessListener{ info ->
if(info.updateAvailability == UpdateAvailability.UPDATE_AVAILABLE){
if(info.updatePriority() > 3 && info.isUpdateAllowed(AppUpdateType.IMMEDIATE)){
// trigger Immediate flow
}
else if(info.isUpdateAllowed(AppUpdateType.FLEXIBLE)){
// trigger Flexible flow
}
}
}
While we make a release we set priority valued as Integer, lets say between 0-5. In our app, we set a threshold lets say 3 and build a decision tree like if priority is greater than 3, then trigger Immediate update, else trigger Flexible update.
2. Staleness Signal: represents how long the device has known about the update.
Example:
appUpdateManager.appUpdateInfo.addOnSuccessListener{ info ->
if(info.updateAvailability == UpdateAvailability.UPDATE_AVAILABLE){
if(info.clientVersionStalenessDays() > 90 && info.isUpdateAllowed(AppUpdateType.IMMEDIATE)){
// trigger Immediate flow
}
else if(info.clientVersionStalenessDays() > 30 && info.isUpdateAllowed(AppUpdateType.FLEXIBLE)){
// trigger Flexible flow
}
}
}
They said this feature will be available soon.
Check full video here: https://youtu.be/_o_q6hatcIs?t=566