Android的编程方式更新应用程序时,一个新的版本可用应用程序、版本、方式、Android

2023-09-13 00:36:01 作者:余生一个浪

在我的应用程序,我想检查是否有我的应用程序的任何更新版本的应用程序商店。如果有任何,则必须通过一条警告消息来通知用户,如果他/她选择升级我想更新新version.I想要做的这一切,通过我的申请。这可能吗?

Within my application, I want to check if there is any updated version of my application is in the app store. If there is any, then have to inform the user through an alert message and if he/she opt for upgrade I want to update the new version.I want to do all this through my application. Is this possible?

推荐答案

我有同样的问题,但解决了JSOUP库。 这里是图书馆下载链接: http://jsoup.org/download

I have the same issue but it resolved by JSOUP library. Here is the library download link: http://jsoup.org/download

String 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();

                Log.e("new Version", newVersion);