5

All is in the title :

Do you know a way (GooglePlay Services ? Free Api ?) to check to current versionCode available on the Play Store ?

I can see that some users of my app still use several old version. So I want to add a preference to check if the app is up to date.

Thanks in advance for helping !

lithos35
  • 250
  • 2
  • 9

2 Answers2

2

You can use android-query for that.

It will give you a result like : https://androidquery.appspot.com/api/market?app=com.google.android.youtube

  • Yes, it seems that this lib should do the trick. Never heard of it before, thanks a lot. Going test it and accept your answer then. – lithos35 Nov 19 '13 at 10:21
  • Works fine. Thanks ! Do you know if there is a way to update some strings of the library ? – lithos35 Nov 19 '13 at 11:46
2

Recently introduced Play Core library gives Version Code of the app.

// Creates instance of the manager.
val appUpdateManager = AppUpdateManagerFactory.create(context)

// Returns an intent object that you use to check for an update.
val appUpdateInfoTask = appUpdateManager.appUpdateInfo

// Checks that the platform will allow the specified type of update.
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
    {
        appUpdateInfo.availableVersionCode()
    }
}

The AppUpdateManager.AppUpdateInfo() will give the latest updatable VersionCode number from Play Store.

Note that it does not give VersionName string value.

Youngjae
  • 24,352
  • 18
  • 113
  • 198
  • I've tried to use the availableVersionCode but it seems to just give me my actual version code of the build im running rather than whats on the play store – alfietap Apr 09 '23 at 16:17