How can I programmatically open/close notifications in Android?

You can programmatically close the notification drawer by broadcasting an ACTION_CLOSE_SYSTEM_DIALOGS intent.

This causes “temporary system dialogs” to be dismissed. From the documentation:

Some examples of temporary system dialogs are the notification window-shade and the recent tasks dialog.

This doesn’t require any permissions, and has apparently been available since Android 1.0.

The following code works for me on a Nexus 4 running Android 5.0:

Intent closeIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
context.sendBroadcast(closeIntent);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)