I want to keep a service running in background, even when my app is killed. I'm using android.intent.action.USER_PRESENT
event but the service only runs when the screen is unlocked. I tried android.intent.action.BOOT_COMPLETED
but it needs to restarts the phone at least once after downloading the app.
Ideally I would start my service all X minutes, using ACTION_TIME_TICK
for instance. Then check conditions (battery level, network connections...) before starting the service.
The problem is such event can't be declared and listened from manifest.xml
but rather in an Activity, implying the app to be 'alive'.
Is there a way to do what I want anyway ?