屏幕点亮和关闭广播监听

private void registerScreenActionReceiver(){ 
    final IntentFilter filter = new IntentFilter(); 
    filter.addAction(Intent.ACTION_SCREEN_OFF); 
    filter.addAction(Intent.ACTION_SCREEN_ON); 
    registerReceiver(receiver, filter); 

 
private final BroadcastReceiver receiver = new BroadcastReceiver(){ 
 
    @Override 
    public void onReceive(final Context context, final Intent intent) { 
        // Do your action here 
 
    } 
 
}; 

你可能感兴趣的:(广播)