I have a service to contact the server to do some data transfer from my app periodically. Its working fine.
But when i restarted(switch off and on) my phone that service can not be restarted. so my idea is that to start that service again when the user open my app after restarting the phone. For that, i have to know about my service is running or not? how to do it?
Any other idea to handle this scenario also thankful.
Thanks in advance.
you need an implementation of
BroadcastReceiver, which is intended onBOOT_COMPLETEDaction. Like this:Also, you should add
receivertag to your manifest file withandroid:name= your fully qualified name of OnStartReceiver and intent-filter tag nested withBOOT_COMPLETEDas intent name, like this: