piyush kalsariya piyush kalsariya - 4 months ago 23
Android Question

Implementing BroadcastReceiver inside JobService

I am working on an application that uses JobService. Now, in my app i want to reschedule the Broadcast receiver that is working in the background. So, i want to know if i can implement BroadcastReceiver inside JobService so that it can restart after several times.

Answer

Yes it is possible. If it's background service, use PowerManager and WakeLock to keep CPU running while you you restart your service. Btw why you need to restart it?

EDIT:

if you want to keep alive your service return START_STICKY in your onStartCommand()

Comments