Android Question Waking from a Sleeping (one question) or Off (second question) State

TheWind777

Active Member
Licensed User
Longtime User
I have a completely working timer app. It has a service task named Overlord which I keep from being dumped via the best possible method (can't remember how I did that at the moment).

I succeeded in adding a Wake if Sleeping function to the service.

... The running program, when put into pause mode by hitting HOME, transfers timing control to the service where it uses a global array to watch timer times and countdown to the next timed reminder. A timer in service module (called OVERLORD) watches the time like an alarm clock and can notify as the countdown progresses (once-per-hour, once-per-minute, then a 59 second countdown after last minute is reached), or it can toast every minute (and notify the countdown during last 60 second countdown.

After the alarm goes-off, I'm having it restart the App and have it automatically go to the right place to display a non-modal dialog.

That's all working perfectly.

...

Now, I want the service to continue even if they shut off their phone.

Can I restart the phone (at their desire, with their knowledge this will occur, and possibly even having been given the startup password if any that they will supply in Settings if they want that feature). Always ending-up in the end having started the phone, supplied the password, run the app and displayed the non-modal dialog.

So, if they completely shut-down their phone, I could like to restart the phone at a particular second, supply the password after it has booted, run the app, figure out the queue again, restart the service, play the sound and display a non-modal with that timer's information, that would be even nicer. I suspect that is when I would have to do a #StartAtBoot in both the App and Service modules???

I assume it would be some combination of StartServiceAt(), start sticky, and/or the addition of other manifest lines. What library would allow me to log-on the phone and supply the password?

I suspect I would add some line, or lines, to the manifest (in one, or both, situations)

...

In the same line of reasoning... when it goes to sleep, and I wake it up with a PhoneWakeState.KeepAlive(True), and they have a password set, is there a way of waking it up and automatically giving it the password so it gets around the need to unlock the phone (they agree to it and put the password into Settings).
 
Last edited:
Top