有没有办法检查Play商店应用版本的代码?

时间:2013-11-19 10:14:36

标签: android google-play

所有内容都在标题中:

你知道一种方法(GooglePlay Services?Free Api?)来检查Play商店中现有的版本代码吗?

我可以看到我的应用的一些用户仍然使用几个旧版本。所以我想添加一个首选项来检查应用是否是最新的。

提前感谢您的帮助!

3 个答案:

答案 0 :(得分:3)

答案 1 :(得分:1)

Google Play不提供任何用于检索元数据的官方API。但是,您可以在http://code.google.com/p/android-market-api/检查非官方API。

具体来说,请查看Wiki页面HowToSearchApps。对查询的响应包含版本信息:

{
  "app": [
    {
      "rating": "4.642857142857143",
      "title": "Ruboto IRB",
      "ratingsCount": 14,
      "creator": "Jan Berkel",
      "appType": "APPLICATION",
      "id": "9089465703133677000",
      "packageName": "org.jruby.ruboto.irb",
      "version": "0.1",
      "versionCode": 1,
      "creatorId": "\"Jan Berkel\"",
      "ExtendedInfo": {
        "category": "Tools",
        "permissionId": [
...

答案 2 :(得分:0)

最近推出的Play Core library提供了应用程序的版本代码。

// 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()
    }
}

AppUpdateManager.AppUpdateInfo()将提供Play商店中最新的可更新VersionCode编号。

请注意,它不会提供VersionName字符串值。

相关问题