1. private BroadcastReceiver screenoffReceiver = new BroadcastReceiver() { 
  2.  
  3.     @Override 
  4.     public void onReceive(Context context, Intent intent) { 
  5.  
  6.  
  7.         Log.i(TAG, "screenoff"); 
  8.     } 
  9. }; 
  10.  
  11.  
  12.  
  13. IntentFilter filter = new IntentFilter(); 
  14. filter.addAction(Intent.ACTION_SCREEN_OFF);         
  15. registerReceiver(screenoffReceiver, filter);