androidgoogle-playin-app-updategoogle-play-core

What happens when using clientVersionStalenessDays() if more updates are available?


I'm looking into supporting in app updates, and wanted to use the google core library for handling this. While doing this a question came up regarding the clientVersionStalenessDays() function. (https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#clientVersionStalenessDays())

Say a user is running version 1 of an app, then i create a new update with version 2 which then is published to the play store. After 2 days i would expect the function to return 2 on the user device. If a new version 3 then was published on day 5 and the same function was run again would it return 5 or 0 since a new version was released the same day?

Related to: Internal app update: clientVersionStalenessDays() returning null when testing with internal app sharing


Solution

  • The method getClientVersionStalenessDays returns the number of days that the Google Play Store app on the user's device has known about an available update. Since version 2 is an update that the PlayStore knows about, the method would return the number of days since version 2 is available.