How to launch service on boot complete android?

后端 未结 2 922
温柔的废话
温柔的废话 2020-12-19 17:27

I\'ve read some tutorial on launch service on boot. What I\'ve done is:

In manifest:



        
相关标签:
2条回答
  • 2020-12-19 18:03

    Did you run your app? Refer to this tutorial

    If you application is installed on the SD card, then it is not available after the android.intent.action.BOOT_COMPLETED event. Register yourself in this case for the android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE event.


    Also note that as of Android 3.0 the user needs to have started the application at least once before your application can receive android.intent.action.BOOT_COMPLETED events.

    0 讨论(0)
  • 2020-12-19 18:26

    You want to start activity or service. In case of service, you will have to call startService(). Like:

    getApplication().startService(new Intent(this, MyService.class));

    0 讨论(0)
提交回复
热议问题