Para mi aplicación, necesito saber que la pantalla está bloqueada. Cómo comprobar esto es problemático. Solía indicador siguiente:Cómo encontrar que la pantalla está bloqueada en android
if(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON != 0){
// some code
}else if((WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED)!= 0){
// some code
}
Pero esto siempre ejecutar tanto si y otra parte ... qué bandera que tengo que usar para comprobar la pantalla está bloqueada o no?
ver las siguientes enlaces [http://stackoverflow.com/questions/3170563/android-detect-phone-lock-event][1] [http://stackoverflow.com/questions/8317331/detecting-when-screen-is-locked][2] [http://stackoverflow.com/questions/3446202/android-detect- phone-unlock-event-not-screen-on] [3] [1]: http: // stackoverflow.com/questions/3170563/android-detectar-phone-lock-event [2]: http://stackoverflow.com/questions/8317331/detecting-when-screen-is-locked [3]: http: //stackoverflow.com/questions/3446202/android-detect-phone-unlock-event-not-screen-on – Shruti
cómo se ejecutará si y si no? –
http://stackoverflow.com/questions/8968265/android-auto-logout-when-app-goes-to-background/8968763#8968763 –