Android : android.intent.action.BOOT_COMPLETED on ICS and Gingerbread

心不动则不痛 提交于 2020-01-02 06:20:24

问题



My application is listening to android.intent.action.BOOT_COMPLETED..

Android :2.3

i am able to get the broadcast when my application is Shut/Active before Boot up.


Android : 4.0.3

I am not able to get the broadcast when my application is Shut(Force Close) before Boot up. Reason is as in this link

Starting with 3.1 when applications are installed they are in a “stopped” state so they will not be able to run until the user explicitly launches them. Pressing Force Stop will return them to this state.

How do i Over Come this??I want to get the broadcast android.intent.action.BOOT_COMPLETED when the application is Shut as well.

Please help!!!


回答1:


The only way is that user should open your app explicitly.




回答2:


add this flag

intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);

I think it will work. Because i have faced the same problem.



来源:https://stackoverflow.com/questions/11775243/android-android-intent-action-boot-completed-on-ics-and-gingerbread

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