Steve Scherer wrote:
> I have a service which starts at boot up time, the service code needs
> the intent of following scenarios.
> 
> 1) When the phone locks(after time out)
> 2)When the user unlocks the screen (by dragging the screen lock
> object)
> 
> Does anybody know how to do this?  There doesn't appear to be an API
> available where an application can be notified when the device is
> locked or unlocked.  It is important the this application be notified
> of these events, since the service utilizes the proximity sensor which
> does not shutdown when the device goes into suspend.  The app will
> need to unload the prox sensor manually to save battery when the
> device gets locked, and reload the prox after the device is unlocked
> again.

Use ACTION_SCREEN_OFF and ACTION_SCREEN_ON. Those are as close as you
are going to get to the actual times of lock/unlock, AFAIK.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in US: 14-18 June 2010: http://bignerdranch.com

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