Android应用程序,检查是否有最新的应用程序版本 [英] Android App , Check for latest app version

查看:222
本文介绍了Android应用程序,检查是否有最新的应用程序版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经找遍了所有周围,我仍然无法找到一种方法/ code,可以让用户检查更新我的应用程序。

I had searched all around and I still can't find a way/code that can allow to user to check for update for my app.

任何人都知道如何做到这一点:

Anyone know how to do this :

检查更新,在应用程序菜单中,当有人点击它,它会显示一个敬酒的消息/进度检查应用程序的版本对话框。

"Check for update" in apps menu when someone click it , it will display a toast message / progress dialog for checking the apps version.

如果新版本中发现的应用程序将自动将其下载到手机上,让用户手动安装更新的应用程序。

if new version is found the apps will auto download it to the phone and let user to manually install the updated apps.

或其他任何方法都行,只要它可以检查最新版本,并通知更新用户。

Or any others method will do as long as it can check for latest version and notify the user to update.

任何人都可以帮助我在这?或者你有一个样品code?

anyone can help me in this? or do you have a sample code ?

感谢

推荐答案

如果它是目前市场上的应用程序,然后在应用程序启动时,火的意图,希望开拓市场的应用程序,这将导致它来检查更新。

If it is an application on the Market, then on app start-up, fire an Intent to open up the Market app hopefully which will cause it to check for updates.

否则,实施和更新检查是相当容易的。这是我的code(大约)吧:

Otherwise implementing and update checker is fairly easy. Here is my code (roughly) for it:

String response = SendNetworkUpdateAppRequest(); // Your code to do the network request
                                                 // should send the current version
                                                 // to server
if(response.equals("YES")) // Start Intent to download the app user has to manually install it by clicking on the notification
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("URL TO LATEST APK")));

当然,你应该重写这个做在后台线程请求,但你的想法。

Of course you should rewrite this to do the request on a background thread but you get the idea.

如果你喜欢的东西一点点,但更复杂,但可以让你的应用程序来自动应用更新请参见这里

If you like something a little but more complex but allows your app to automatically apply the update see here.

这篇关于Android应用程序,检查是否有最新的应用程序版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆