9

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

Nirel
  • 1,855
  • 1
  • 15
  • 26

1 Answers1

3

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()
Amir Hossein Ghasemi
  • 20,623
  • 10
  • 57
  • 53
  • I know that I can do it using Accessibility Service, looking for something else.. – Nirel Jul 08 '20 at 19:18
  • 1
    Just look the answer clearly, I said you can do this with accessibility and `notificationListenerService` , there is no way rather than these two. too funny I answer and get negative for that! – Amir Hossein Ghasemi Jul 09 '20 at 15:49