Receive the Home key broadcast event in the app
First, customize a broadcastreceiver:
classHomekeyeventbroadcastreceiverextendsBroadcastreceiver {Static FinalString System_reason = "REASON"; Static FinalString System_home_key = "HomeKey";//Home Key Static FinalString System_recent_apps = "Recentapps";//Long Home key@Override Public voidOnReceive (Context context, Intent Intent) {String action=intent.getaction (); if(Action.equals (intent.action_close_system_dialogs)) {String reason=Intent.getstringextra (System_reason); if(Reason! =NULL) { if(Reason.equals (System_home_key)) {//Home key processing point } Else if(Reason.equals (System_recent_apps)) {//Long Home key processing point } } } } }
Second, the generated and registered
New homekeyeventbroadcastreceiver (); New Intentfilter (intent.action_close_system_dialogs));
Android Home Keys Those things
Turn http://blog.csdn.net/imyfriend/article/details/8293399
Android Home Keys Those things