Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Click notification action button programmatically

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

like image 519
Nirel Avatar asked Mar 17 '16 08:03

Nirel


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()
like image 197
Amir Hossein Ghasemi Avatar answered Oct 19 '22 15:10

Amir Hossein Ghasemi