I'd recommend trying a remote service to do the things you want to
persist

On Dec 22 2009, 8:09 am, Wes <[email protected]> wrote:
> All,
>
> I've been writing some code to toggle thescreenfrom "bright" to dark
> (off).  I've been using this code to turn thescreenoff:
>
>         WindowManager.LayoutParams lp = getWindow().getAttributes();
>         lp.screenBrightness = 0;
>         getWindow().setAttributes(lp);
>
> And this to turn it back on:
>
>         WindowManager.LayoutParams lp = getWindow().getAttributes();
>         lp.screenBrightness = 1;
>         getWindow().setAttributes(lp);
>
> The problem is, it's very difficult to wake thescreenback up because
> of all the power saving things that go into effect when you turn 
> thescreen"off" using brightness = 0;  Let me first point out that I'm
> not really tied to power constraints in this particular application.
> One of my assumptions is that this device (Droid) will be plugged in
> when this application is run.  Ideally, I'd like to not hammer the
> battery if I don't have to, but I'm open to it if it's the only way.
>
> So, back to the issue...when the display is off, pretty much
> everything shuts down.  For instance, one idea I had was to shake the
> display back awake by reading the accelerometer.  However, as soon as
> the display goes off, my listener that was reading values from the
> accelerometer (be it in an activity or a service) stops echoing
> values.
>
> I can't register any key listeners because when the display is off, if
> I press anything other than the unlock button (e.g. volume up/down,
> camera button, etc.) I get the following output in the debugger:
>
> WindowManager: No focus window, dropping: KeyEvent...etc.
>
> In short, it appears that once the display goes dark, the only way to
> interact with the user is by hitting the "unlock" button.  This isn't
> ideal because it's awkwardly placed.
>
> I had *really* hoped to be able to re-activate the device by pressing
> anywhere on the touchscreen.  I can understand that the touchscreen
> is disabled for power reasons, but I was hoping I could override that
> (given I don't mind the power draw).  Failing at that, I'd settle for
> any of the accessible keys (even the keyboard) reacting to user input
> and waking the thing up.
>
> Any thoughts or ideas on this subject?
>
> Thanks for your time.
>
> Wes
-- 
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