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

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您错了。给定的代码将用户重定向到 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).