You can use - ACTION_CLOSE_SYSTEM_DIALOGS
Broadcast: This is a broadcast when a user action needs to request a temporary system dialog for rejection.
public static final String ACTION_CLOSE_SYSTEM_DIALOGS
Added to API Level 1
Broadcast Action: This is a broadcast when a user action needs to request a temporary system dialog for rejection. Some examples of temporary system dialogs are the notification window and the recent tasks dialog.
Constant value: "android.intent.action.CLOSE_SYSTEM_DIALOGS"
Working example -
Android Manifest -
<receiver android:name=".SystemDialogReceiver"> <intent-filter> <action android:name="android.intent. action.CLOSE_SYSTEM_DIALOGS" /> </intent-filter> </receiver>
Class file -
class SystemDialogReceiver extends BroadcastReceiver { private static final String SYSTEM_DIALOG_REASON_KEY = "reason"; private static final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps"; @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)){ String dialogType = intent. getStringExtra(SYSTEM_DIALOG_REASON_KEY); if(dialogType != null && dialogType. equals(SYSTEM_DIALOG_REASON_RECENT_APPS)){ Intent closeDialog = new Intent(Intent. ACTION_CLOSE_SYSTEM_DIALOGS); context.sendBroadcast(closeDialog); } } } }
My God Jun 03 '14 at 11:21 2014-06-03 11:21
source share