Play商店获取应用市场版本信息

Play商店获取应用市场版本信息

本文介绍了如何从Google Play商店获取应用市场版本信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Play商店应用程序更新时,如何在用户使用旧版本应用程序时,如何从google play store获取应用程序版本信息以提示用户强制/推荐更新应用程序。我已经浏览了,这不是官方的方式,也需要从谷歌认证。我也通过
提供了应用内版本检查,但它不适用于我的情况。
我发现了以下两种备选方案:


  • 使用将存储版本信息的服务器API

  • 使用谷歌标签并在应用程序中访问它,这不是一个首选的方式。



是否有其他方法可以做到这一点很容易?

解决方案

我重新推荐不要使用库只是创建一个新类



1。

  public class VersionChecker扩展AsyncTask< String,String,String> {

String newVersion;

@Override
protected String doInBackground(String ... params){

try {
newVersion = Jsoup.connect(https:// play.google.com/store/apps/details?id=+软件包名称+& hl = en)
.timeout(30000)
.userAgent(Mozilla / 5.0 Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6)Gecko / 20070725 Firefox / 2.0.0.6)
.referrer(http://www.google.com)
.get()
.select(div [itemprop = softwareVersion])
.first()
.ownText();
} catch(IOException e){
e.printStackTrace();
}

return newVersion;
}




  1. 您的活动:

      VersionChecker versionChecker = new VersionChecker(); 
    String latestVersion = versionChecker.execute()。get();


全部是


How can I get the application version information from google play store for prompting the user for force/recommended update of the application when play store application is updated i.e. in case of user is using old version application. I have already gone through andorid-market-api which is not official way and also requires oauth login authentication from google. I have also gone through android querywhich provides in-app version check, but it is not working in my case.I found following two alternatives:

  • Use server API which will store version info
  • Use google tags and access it in app, which is not a preferred way to go.

Is there any other ways to do it easily?

解决方案

I recomned dont use a library just create a new class

1.

public class VersionChecker extends AsyncTask<String, String, String>{

String newVersion;

@Override
protected String doInBackground(String... params) {

    try {
        newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + "package name" + "&hl=en")
                .timeout(30000)
                .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                .referrer("http://www.google.com")
                .get()
                .select("div[itemprop=softwareVersion]")
                .first()
                .ownText();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return newVersion;
}
  1. In your activity:

        VersionChecker versionChecker = new VersionChecker();
        String latestVersion = versionChecker.execute().get();
    

THAT IS ALL

这篇关于如何从Google Play商店获取应用市场版本信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 06:26