How to register a service that will work all the time

I would like my Android app to work all the time. that is - 1. immediately after installation, 2. at boot 3. if you close it - it will be restarted -

how can i achieve all of the above code?

thank!

+3
source share
2 answers

I do not put the code here, but you can easily find it.

  • Immediately after installation, use the default action to start the service, if you do not have any user interface, then create an action without any interface (without setContentView) and start the service in its onCreate.

  • broadcastReceived, ACTION_BOOT_COMPLETED Service Manager. .

  • , .

+5

Service ! Android - START_STICKY Service onStartCommand(). Android .

.

+5

All Articles