> I am newer to Android development and I have a app that needs to run a
> command even if the phone goes to sleep.
>
> I have it running as a service but it runs randomly when.
> Is there a way to have the service run even when the phone is
> sleeping.

Use AlarmManager. Keep your service stopped normally, and use an alarm to
wake up the device and run your code.

http://tinyurl.com/y9mttv5

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to