开发者

Android Can an application request reinstallation of its own APK? (from installation service)

I have an android admin which performs all admin functions on my tablet, now I need a way to update the admin application inself. I don't really want to install yet another app to do this, however what I am finding is that there is an error when an application brings up the Android installer and passes it an APK file that is the same as the calling application, it does not show a successful install. Is there anyway for an application to update itself with a new apk. (Restart is OK) It is really quite common in general to allow apps to be self updating often requiring a restart of the application?

Here is the code:

(Environment.getExternalStorageDirectory() + "/download/" + apkName)), "application/vnd.android.package-archive"); context.startActivity(intent);

Where apkName is the same application as is issuing this call?

If this cannot be done, what are my op开发者_JAVA百科tions without installing yet another admin to update the admin application?


Just a guess, but try setting the flag FLAG_ACTIVITY_NEW_TASK on the Intent you fire to start the APK Installer. When an APK is updated or reinstalled, the application must be closed which would kill any task it is running. If the installer is running from the same task, it might be interfering.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜