lannyf
lannyf

Reputation: 11035

on android 12 how to close the notification drawer when tap on the action button

When tap on notification's action button, if it is handled in a service the notification drawer could be closed with

public void onReceive(final Context context, final Intent intent) {
    ... ...
    Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    context.sendBroadcast(it);
}

But from android 12 it is deprecated and not be able to close the notification drawer. And this is in a library which does not have an active accessibility service. How to close the notification drawer when tap on notification's action button?

Upvotes: 9

Views: 1111

Answers (1)

cuzi
cuzi

Reputation: 1097

This is not an answer to this question, but I thought it still might be helpful for other people:

If the app happens to have a TileService running, you can use startActivityAndCollapse to start an activity and collapse the notification panel.

Upvotes: 1

Related Questions