以编程方式获取 Android 市场的版本号

发布于 2024-12-21 13:43:18 字数 388 浏览 7 评论 0原文

我正在寻找一种方法来检查我的应用程序的市场版本与设备上安装的版本的比较,如果存在差异,请前往市场进行更新。我不想使用网络服务。如果手机版本与市场版本不同,我在下面粘贴的代码可以通过在应用程序启动时将用户发送到市场来实现我想要的功能(我不明白如何操作,但确实如此......如果有人可以解释这一点,那就太棒了! )我希望能够在用户访问市场时为他们提供选择。查询结果是否有告诉 Android 进入市场的信息?有没有办法在市场上查询版本号?这是代码:

Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse("market://search?q=" + APPLICATION_NAME));
        startActivity(intent); 

I am looking for a way to check the market version of my application compared to the installed version on the device and if diff, go to market to update. I do not want to use a web service. The code I pasted below does what I want by sending user to market on launch of application if the phone version is different from the market version (I don't understand how, but it does...if someone can explain this, great!) I want to be able to give the user a choice if they visit the market. Is there a result from the query that tells Android to go to market? Is there a way to query the market for the version number? Here is the code:

Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse("market://search?q=" + APPLICATION_NAME));
        startActivity(intent); 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残月升风 2024-12-28 13:43:18

您错了。给定的代码将用户重定向到 Android Market 的给定应用程序页面,并且每次执行代码时都会执行此操作(没有版本比较)。

You are wrong. Given code redirects user to Android Market to given app page and it does it every time the code is executed (no version comparing).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文