Hi.

Really appreciate your tips.

Yes I can leave the screen alone and turn off by itself. But my
problem is, with the light sensor readings, I want to turn on the
screen again.

Seems when screen is turned off, sensors are not working. So I had to
use TimerTask to turn on screen and read the light sensor. If the
reading is above my defined margin, keep the screen on otherwise allow
to turn off by itself or by force.  But with a Service, screen does
not turn off until the TimerTask fires to turn on the screen. Once it
is fired, screen goes off and at the same time it wakes up according
to my logic.

But with an Activity this worked smoothly.  So my problem is, why this
work in an Activity and not in a Service.

Thanks
Kelum

On May 31, 4:56 am, Mark Murphy <[email protected]> wrote:
> On Wed, May 30, 2012 at 6:33 AM, kelum prasad <[email protected]> wrote:
> > I tried with wake locks in Power Management API  to turn on and turn
> > off the screen.
>
> You don't turn off the screen. Android turns off the screen, based on
> the user's preferred screen timeout interval.
>
> > Is there any reason not to turn off the screen with
> > PARTIAL_WAKE_LOCK ?
>
> It does not work.
>
> > I tried with the property
> > "android.provider.Settings.System.SCREEN_OFF_TIMEOUT" to turn off the
> > screen.
>
> Please leave the user's settings alone, unless the user is expressly
> expecting you to mess with their settings.
>
> > Can anyone please help me to find a solution for this.
>
> Leave the screen alone, and it will turn off when the user decided
> that it should turn off.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.7 Available!

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