Click notification action button programmatically

Viewed 1122

How can I click a notification action button programmatically (another application notif, not my)? I can click a normal button by using the button.performClick() method. I have accessibility service to listen to incoming notification (and Notification Service listener to android 5.0+), So,there is any way to do that?

For example, click Turn on battery saver or share/delete pragmatically

...

enter image description here

1 Answers

You need to handle this via Accessibility Service or NotificationListenerService

after that when you get Notification class, you can do it by this function:

sbn.notification.actions[0].actionIntent.send()
Related