Tuesday, May 11, 2010

[android-developers] How do I enable the phone's key guard programmatically?

Hi!

How do I enable the phone's key guard programmatically?

The use case is that I want to make an app that enables the key guard
when I use my Bluetooth headset to answer a call.

Currently with my HTC Hero there's no way for me to physically enable
the key guard during a call since the phone's lock button doubles as a
hang-up button during calls. And if I answer a call with my phone in
my pocket the phone tends to hang up on me after a while...

PowerManager.goToSleep() looks promising, but apparently I'm not
allowed to call that without the DEVICE_POWER permission which I can't
have. And even if I could call it, would it do the right thing during
a call?

KeyLockManager only seems useful for people who want to *prevent* the
lock screen from appearing, but I want to trigger it.

Help!

//Johan

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate