I am writing an Android application that can be considered a bit like a stopwatch/gps logger type thing. Effectively, user configures some options, hits "go" and then puts the phone in their pocket whilst they (physically) run for a while. During this time, I would like the app to keep running under the lock screen (so keypresses whilst it is in the player's pocket don't interrupt it). I would also ideally like it to continue to play sounds at predetermined points as a timer counts down.
In terms of settings I have at present:
On the Android properties tab for the application, I have the back button disabled. I also have the "End Application when not in foreground" button unchecked. Build API is 14, minimum Android 2.2 and the .apk builds and installs fine.
Runtime options (not sure how relevant these are) that I could image may alter this are "run while minimised" and "run while resizing" enabled. Also set to not mute samples when application loses focus.
The behaviour at the moment is that when I do exit back to the home screen of the phone is that the app effectively seems to pause; when I open the app again, it resumes at that point (as opposed to starting again on the title screen).
I effectively see three possible outcomes (best->worst):
1. There is some way to make the apps keep running "in the background" and playing sounds during this time that I have missed.
2. The app will always pause, however, there is some way of taking note of the system clock of the android device at the moment the app is minimised/closed, then when it opens up again (when the player wants to check their progress) it could compare the new system clock timestamp to the one recorded when it shut down and work out the difference and from this update the internal timers to work out how much time has elapsed.
3. There is no way to stop this behaviour and it would be necessary to root the device, disable the home button and then implement some form of "in app lock screen" of my own, so that players leave it running whilst it's in their pockets.
I was wondering if anyone could offer advise on how best to achieve (any of) the above? Many thanks in advance.