> On Dec 15, 10:07 pm, Tim <[email protected]> wrote: >> I also have this problem and there doesn't seem to be a way around it. >> And no, I'm not 'doing it wrong'. Polling really would be best in my >> case - my app reacts to received SMS's and needs to do different >> things depending on whether the screen is on or not. > > Aha! I found a (possible) solution. I haven't tried it yet, but there > is an undocumented hidden public method: > > boolean PowerManager.isScreenOn()
Please don't access "undocumented hidden public methods": http://www.androidguys.com/2009/12/14/code-pollution-reaching-past-the-sdk/ As I wrote, just watch for ACTION_SCREEN_OFF and ACTION_SCREEN_ON Intents and track the state yourself. If you find that unpleasant, file a feature request to either expose isScreenOn() or the equivalent in the SDK, or make the ACTION_SCREEN_* Intents sticky, so you can more truly poll. -- 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

