首先需要注册需要监听的状态:
IntentFilter filter = new IntentFilter();
//关闭屏幕
filter.addAction(Intent.ACTION_SCREEN_OFF);
//点亮屏幕
filter.addAction(Intent.ACTION_SCREEN_ON);
//滑动解锁
filter.addAction(Intent.ACTION_USER_PRESENT);
//注册监听
registerReceiver(new FXBroadcastReciver(), filter);
在广播接收中想要处理哪个就接应一下就OK.