如何在Playstore上获取我的应用程序的当前版本?

时间:2022-11-27 07:22:42

I want to show an update dialog as the app opens when there is an update of my app on Playstore.

当Playstore上的应用程序更新时,我想显示一个更新对话框。

I've tried following code but getting response:

我试过跟随代码但得到回应:

Appsresponse:-entriesCount: 0

TelephonyManager telephonyManager =
                   (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String udid = telephonyManager.getDeviceId();
MarketSession session = new MarketSession();
session.login("username","password");
session.getContext().setAndroidId("dead000beef");

String query = "pname:<Package name>";
AppsRequest appsRequest = AppsRequest.newBuilder()
            .setQuery(query)
            .setStartIndex(0)
            .setEntriesCount(10)
            .setWithExtendedInfo(true)
            .build();

session.append(appsRequest, new Callback<AppsResponse>() {
            @Override
            public void onResult(ResponseContext context, AppsResponse response) {
               System.out.println("Appsresponse:-"+response);
               // response.getApp(0).getCreator() ...
               // see AppsResponse class definition for more infos
            }
});
session.flush();

I might be using the wrong Android ID, but I don't know from where I'll get the Android ID.

我可能使用了错误的Android ID,但我不知道从哪里获得Android ID。

1 个解决方案

#1


0  

imho as njzk2 says is annoying, but if you want continue on this way you can give a try on this (check on google link example and on github how it's accomplished):

imho as njzk2说是烦人的,但如果你想继续这种方式你可以尝试这个(检查谷歌链接示例和github如何完成):

https://code.google.com/p/android-query/wiki/Service

https://github.com/androidquery/androidquery

have a nice coding

有一个很好的编码

#1


0  

imho as njzk2 says is annoying, but if you want continue on this way you can give a try on this (check on google link example and on github how it's accomplished):

imho as njzk2说是烦人的,但如果你想继续这种方式你可以尝试这个(检查谷歌链接示例和github如何完成):

https://code.google.com/p/android-query/wiki/Service

https://github.com/androidquery/androidquery

have a nice coding

有一个很好的编码