Start Android Service on boot time Android 4.0

蹲街弑〆低调 提交于 2019-12-14 03:00:44

问题


I'm triying to start a android service in android 4.0 when the device is booting, in boot time, but it's imposible , I had be used many codes, copy and paste. I had used code from here, stackoverflow of others examples and questions , but for me is imposible. I'm using android 4.0.1 in a table Acer Iconia A501. I put my code here. Somebody Can it try this code??? this is the page :This page please, it is easy


回答1:


You need to register a broadcast receiver for the intent that is broadcast on startup. There is ZERO doubt that this is what you need to do.

See: BroadcastReceiver not receiving BOOT_COMPLETED

You need to do the same. Register a broadcast receiver and first make sure that you are catching the BOOT_COMPLETED event. Then its just a matter of doing a startService.

The problem is most likely in the Manifest. Check that you have exactly the right name for everything. Note the . in names like .MyBroadcastReceiver These are important. Missing just one thing will cause a problem.

Both the Receiver and Service definition must be perfect. Also check logcat and tell us what errors are there.



来源:https://stackoverflow.com/questions/11640142/start-android-service-on-boot-time-android-4-0

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