(I haven't found the following question clearly answered elsewhere, so I'll ask here.)
I subclassed BroadcastReceiver to capture new photos being captured. This subclass works great, but if my application's process isn't alive, my custom BroadcastReceiver also isn't running and hence doesn't trigger when relevant intents are sent.
What's the recommended approach for a persistent (truly, not if my application is running) BroadcastReceiver? I get the impression that I should use a Service, but it's not clear to me what goes into my Service other than:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}
which, I believe, persists the Service. Otherwise, it seems strange to me that the BroadcastReceiver, the one that's actually referenced in my AndroidManifest.xml, has no reference in my Service.
(On a side note, I have another custom BroadcastReceiver, whose sole purpose is to start the aforementioned Service upon device startup. Thank you, Android BroadcastReceiver on startup.)