android - At onResume() how to identify if onPause() was called because of screen lock or app minimised -


i have binder service binds @ onresume. @ onresume want check if previous onpause called because of app minimised or screen lock lock button. have tried action_screen_on , action_screen_off , setting boolean value, problem binder @ onresume called before receiver gets value.

use below code detect whether screen locked in onpause() method

keyguardmanager km= (keyguardmanager) context.getsystemservice(context.keyguard_service); if( km.inkeyguardrestrictedinputmode()) {  //screen locked } else {  //it not  } 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -