For that matter, it'd be nice if I could stop certain apps from running in the background at all. A task killer isn't the answer here - a few seconds is enough to gather some data and transmit it, and at that point the damage is done.
For that matter, it'd be nice if I could stop certain apps from running in the background at all. A task killer isn't the answer here - a few seconds is enough to gather some data and transmit it, and at that point the damage is done.
What would be interesting IMO were some way to see which app has registered which intents and possibly an option to override those registrations.
When the app goes into the background the system invalidates the token, so any work waiting in queue somewhere will actually fail on the token check when it comes up.
If you want to ask a background service (of your own), or fire off an intent, you pass the ForegroundToken with it. If the work starts while your app is still in the foreground peachy, if not, it fails.
In a foreground > background > foreground cycle, your app gets a new ForegroundToken on every onResume event.
If you want apps to have true background access to a permission, that is a separate toggle (yes more complicated I know, but theoretically possible). They then can pass null into the ForegroundToken argument.
1. More finegrained permissions (per api call basically)
2. Ability to give/deny permission per use case or some time.