简体   繁体   English

Android Developer如何从游戏市场获取versionCode或versionName

[英]Android Developer How get versionCode or versionName from play market

I need to check version on play market. 我需要在游戏市场上检查版本。

I don't how can i do it. 我不怎么做。

I try find decision on google, but i no fond details for my problem. 我尝试在Google上找到决定,但我不喜欢我的问题的详细信息。

My code is: 我的代码是:

PackageInfo manager;
      try {
        manager = getPackageManager().getPackageInfo(getPackageName(), 0);
        Integer curVersion = manager.versionCode;
        Log.d("Cosmopizza", "Installed version = " + curVersion);
        Integer marketVersion = ??????;
        Log.d("Cosmopizza", "Market version = " + marketVersion);               
        String _url = getGooglePlayStoreUrl();    
        Log.d("Cosmopizza", "link to market = " + _url);    
        if (curVersion

there is no api inside android or google play services to get the latest version of you app. android或google play服务中没有api来获取您应用的最新版本。

you have two choices how to get the version 您有两种选择方式来获取版本

  • build a small webservice where you manually enter the latest version and check against this service 构建一个小型Web服务,您可以在其中手动输入最新版本并对照该服务进行检查
  • parse the play store website to get the latest version information (best in a custom webservice). 解析Play商店网站以获取最新版本信息(在自定义网络服务中最佳)。 but i think there you'll only get the versionName and not the versionCode. 但我认为您只会得到versionName而不是versionCode。 it seems there is an api service (100 free requests/month) that helps with this trick otherwise you could try something like this or this but no idea if they still work. 它似乎有一个API服务 (100免费申请/月),与此招有助于否则你可以尝试像这样这样 ,但不知道他们是否仍然有效。 :) :)

good luck :) 祝好运 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM