IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
mContext.registerReceiver(mReceiver, intentFilter);
private static BroadcastReceiver mReceiver = new BroadcastReceiver() {
<span style="white-space:pre"> </span>@Override
<span style="white-space:pre"> </span>public void onReceive(Context context, Intent intent) {
<span style="white-space:pre"> </span>String reason = intent.getStringExtra("reason");
<span style="white-space:pre"> </span>if (reason == null) {
<span style="white-space:pre"> </span>return;
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>//recentapps 最近app键盘,homekey:home键
<span style="white-space:pre"> </span>if (reason.equals("recentapps") || reason.equals("homekey")) {
<span style="white-space:pre"> </span>//you code
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>};
另外参考:< a href='http://blog.csdn.net/peidonghui/article/details/8178559'>锁屏广播也可能此问题