Auto-restart app after market update

时光怂恿深爱的人放手 提交于 2019-12-01 16:12:47

It's something you'll have to test carefully but you should be able to catch it with a broadcast receiver with the action Intent.ACTION_PACKAGED_REPLACED

Then you start the service from your receiver.

If your app is running on API 12 or higher, I would recommend registering a BroadcastReceiver listening to android.intent.action.MY_PACKAGE_REPLACED.

This Intent is only triggered if YOUR application got an update.

Register a BroadcastReceiver to Intent.ACTION_PACKAGE_REPLACED

Then, compare EXTRA_UID with your own. If it matches, you can start your service again.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!