How to reject the system dialog in Android?

I need to reject this Dialog system (attached below). I get this value, but I can’t disable it programmatically in the Service not in action.

My question is:

  • Is it possible to fire him? if yes, please help me or help me how to achieve it.

enter image description here

+35
android
Jun 03 '14 at 11:16
source share
4 answers

Please, check him

 @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (! hasFocus) { Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); sendBroadcast(closeDialog); } } 

It works in my code.

+16
Jun 03 '14 at 18:47
source share

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"

This information is on the Android developer site .

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); } } } } 
+18
Jun 03 '14 at 11:21
source share

Try using the following:

 sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); 
+9
Jun 03 '14 at 11:18
source share

You can use ACTION_CLOSE_SYSTEM_DIALOGS when the focus is lost. But keep in mind that this will also prevent the phone from turning off while your application is running, because the Power Off dialog box is also a system dialog.

+1
Aug 28 '14 at 18:06
source share



All Articles