开发者

How do you run code after an Android application has been installed?

Does anyone know of a good way to have code run after their Android application has been installed?

Something like ACTION_PACKAGE_ADDED that would get delivered to the application that was just installed.

This is for a zero configuration scheme where the configuration for the device comes from a 开发者_开发问答webservice.

These settings are used in BroadcastReceivers.

One approach is to fetch the settings the first time. Since this would be done BroadcastReceiver, and since it might take a moment to fetch the result, I'm reluctant to use this approach.


The intent ACTION_PACKAGE_ADDED will not be received by the just-installed application. However, there may be some broadcast messages to trigger on in order to start your application automatically. I think, the best way is to use the BOOT_COMPLETED broadcast message, so the settings are loaded the first time device powers on.

I don't now anything about your device, but whenever you are providing Android on these devices, you could pack this app (and your settings) within a firmware update. Or you'll just reboot the device after installing this package..

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜