开发者

Auto Update APK version on Android Phone

If a user downloads my app (a .apk file) onto their android phone from the market place,

  1. Where does the .apk file end up on their phone?
  2. When they're running my application, if I detect that there is a new later version of the application available is it possible to from within the application that they're running download the latest version off an ftp link (I can programmatically do that now) and then replace the existing .apk that they're now running with the newer version. [Not sure about this one at all.]
  3. Is the existing application all in memory when it's being run, so that when i download the new version, I can delete its apk file without it being locked up and replace it开发者_如何学Python with the later build and then restart the app?

What's the best way to handle this scenario? I have an app where I want to ensure that users are on the latest version before they use it.


Apps are stored in /data/app see https://android.stackexchange.com/questions/3002/where-in-the-file-system-are-applications-installed.

IMHO, You should let the market manage updates for you, there's no need to bother doing anything by hand and as an user I would be "angry" if some app start downloading stuff on my phone without my consent, especially when abroad (some users are paying their datas).


If this user has rooted phone, you may use code provided in this answer: Android silent apk update.

If not, user has to be prompted, and you may start an activity with an intent (as usual), but also, before calling startActivity(intent), call intent.setDataAndType(Uri.fromFile(...)).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜