Doing this kind of stuff from third party apps isn't really supported.  You
may be able to hack up a somewhat working solution, but I don't think you
can actually implement a fully working robust solution with the SDK APIs.

On Fri, Apr 8, 2011 at 12:24 AM, luiX_ <[email protected]> wrote:

> Hi,
>
> I'm trying to develop something similar to the proximity event of the
> dialer during a call, this is: when something is near the proxmity sensor
> turn off the screen and when there's not power it on again.
>
> I've had no problem making the sensor's events work, that was easy, but I'm
> having a lot of trouble trying to set the screen on/off, this is what I've
> got this far:
>
>    - I can power the screen off by setting brightness to zero (using the
>    WindowManager.LayoutParams), the problem is that it locks the screen 
> instead
>    of just setting it off.
>    - I've tried using a PowerManager.WakeLock to several things:
>       - using as flag PARTIAL_WAKE_LOCK which should keep the cpu running
>          but allowing the screen and keyboard to go off (but not actually 
> setting
>          them off at the moment, it waits for the configured timeout)
>          - using as flag SCREEN_DIM_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP and
>          then setting the screen off using the brightness "trick" but I still 
> do have
>          to manually press the button to bring the screen up.
>
> Now, I'm playing with some flags in the Window, but still nothing, I always
> do have to bring the screen back by pressing the power button.
>
> Any ideas/snippets to make this work like when you're inside a call in
> Android's default dialer?
>
> Thanks! :)
>
> --
> 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




-- 
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, and so won't reply to such e-mails.  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