I have a service that will be started every once in a while via an AlarmManager.
When it starts I want to be able to check if the device is currently being used or if it is idle.
I could simply check if the screen is on, but it is possible that if the device was charging, or on a dock, that the s开发者_如何学编程creen could be on but not being used. So that is is not a perfect method.
Is there a solid way determine that the device is idle?
If not, I figure if the device is plugged in, then in my case I could just carry on as if the device was idle. However, I haven't been able to find a way to check if the phone is plugged in beyond capturing a Broadcast Intent. Is there a way to just check without having to capture the broadcast intents continually?
Android has an in built application called Autolock that can be customized.Please refer these links. http://www.androidtapp.com/autolock/ http://developer.android.com/guide/practices/design/responsiveness.html Hope this will help you.
精彩评论