Right - but I only want to display a dialog activity when the screen is off
- if the screen is on (ie. user is doing something) then I want to just use
a Notification so as not to interrupt the user experience (as recommended in
the docs).

So alternatively - is there a way to detect if the screen is on? :)

Adam

On Mon, Nov 24, 2008 at 2:31 PM, Dianne Hackborn <[EMAIL PROTECTED]>wrote:

> There is no need to find out whether the screen is off for this, just
> acquire a wake lock that turns the screen on (if it isn't already) like the
> alarm app does.
>
> On Mon, Nov 24, 2008 at 11:00 AM, Adam K <[EMAIL PROTECTED]>wrote:
>
>> Yes I realize this, which is why I have a 5 minute timeout on the wakelock
>> (and on the notification).  I also have this as a preference for my app so
>> you can turn it on or off as suits you (some users specifically requested
>> this feaure).
>>
>> IMO, turning on the screen for a short period of time and optionally
>> displaying a message (on top of the keyguard) should be a part of a
>> Notification object.  The built-in alarm does exactly this (which is
>> basically what I want to do - except if the user is playing a game or doing
>> something when my alarm goes I want to use the regular Notification manager
>> so as not to disrupt the user - something the built-in Alarm should probably
>> do ...)
>>
>> So back to my original question - is there a way to detect if the screen
>> is off?
>>
>> Adam
>>
>>
>> On Mon, Nov 24, 2008 at 9:28 AM, Jean-Baptiste Queru <[EMAIL 
>> PROTECTED]>wrote:
>>
>>>
>>> Forcibly turning the screen on when you're not sure that the user is
>>> looking is a sure way to drain the battery in a few hours. You should
>>> probably avoid that.
>>>
>>> JBQ
>>>
>>> On Sun, Nov 23, 2008 at 8:52 AM, Adam K <[EMAIL PROTECTED]>
>>> wrote:
>>> >
>>> > Hi all,
>>> >
>>> > Is there a way to detect if the screen is off?  I want to be able to
>>> > show a dialog if the screen is off (using a wakelock) but if the
>>> > screen is on I want to show a notification (so as not to interfere
>>> > with what the user is doing).
>>> >
>>> > Thanks,
>>> >
>>> > Adam
>>> > >
>>> >
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> [EMAIL PROTECTED]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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