Notification Interaction - Click action number 2 Cannot invoke action 2 notification has no actions java.lang.ArraylndexOutOfBoundsException

aitn

Member
Hello,

I got the following phone:

Moto G Pure | 2021 | 2-Day battery | Unlocked | Made for US by Motorola | 3/32GB | 13MP Camera | Deep Indigo
https://www.amazon.com/gp/product/B09BTB5MKT/

It has an Android 11 installed. I installed the Wire app.
When I call to it, it shows a notification "XXX Calling..." with two options: "Decline" and "Open Call"

I'm trying to invoke the Notification Interaction - Click action number 2
action on it to answer the incoming call, and the notification keep showing as it's being ignored.
Looking at the macro log, it shows:

Notification Interaction
Cannot invoke action 2:
java.lang.ArraylndexOutOfBoundsException: length=1; index=1
Cannot Invoke action 2 Notification has no actions

I also tried to use a UI Interaction with click content "Open Call" and seem to be ignored too.

Any idea how to get this to work? Is this a bug with Macrodroid?
@Dimlos Are you able to reproduce with the same phone and app?

Thank you.
 
Last edited:

Dimlos

Well-known member
It seems to be possible to make them click on the coordinates.
 

Attachments

  • Wire_Open_Call.macro
    2 KB · Views: 1

Endercraft

Moderator (& bug finder :D)
...what ? How does the notification display ? does the notification display at all in DND ? Have you tried the macro from the link I included ?
 

aitn

Member
...what ? How does the notification display ? does the notification display at all in DND ? Have you tried the macro from the link I included ?
It doesn’t display in DND. I don’t think think you can rely on ui interaction for notifications in DND. That’s why I tried to get notification interaction to work instead.

I don’t see any macro link you included?
 

aitn

Member
It probably means that you can't interact with this programmatically.
Why some notifications can’t be interacted programmatically? Isn’t it an os thing all apps should use the same kind of notification dialog framework so Macrodroid could interact with all of them? Maybe the actions macrodroid uses for notification interaction are not matching the options on the notification? So it’s action identifier mismatch from macrodroid?
 

Dimlos

Well-known member
If notifications are decorated instead of normal text, they are often not operable in MacroDroid.
The developer of the application may have wanted to make the notification easy to read, but it becomes an obstacle for automatic processing.
 

Attachments

  • notification.jpg
    notification.jpg
    196.8 KB · Views: 4

aitn

Member
If notifications are decorated instead of normal text, they are often not operable in MacroDroid.
The developer of the application may have wanted to make the notification easy to read, but it becomes an obstacle for automatic processing.
@MacroDroidDev So if it's a customized notification, can't you/I inspect/find the special options identifiers used in it and then configure a custom action identifier notification interaction in macrodroid so it can interact with it? Is this a limitation of the os/android that prevents macrodroid from interacting with a customized notification or is it just an unsupported feature of macrodroid?

@Jacob L Is there a way to convert a customized notification into a standard notification or a toast using another app so then it can be interacted with through macrodroid?

@Dimlos I have do not disturb mode so I don’t have the notification showing like that so I can't use ui interaction based on x,y coordinates.
Any other suggested workarounds to answer while being on DND? i.e. Take it to the app when it triggers and then answer somehow assuming macrodroid could interact with any widgets within the app and/or is there an action to turn off DND and then turn it back on?

Thank you.
 
Last edited:

Endercraft

Moderator (& bug finder :D)
@MacroDroidDev So if it's a customized notification, can't you/I inspect/find the special options identifiers used in it and then configure a custom action identifier notification interaction in macrodroid so it can interact with it? Is this a limitation of the os/android that prevents macrodroid from interacting with a customized notification or is it just an unsupported feature of macrodroid?

@Jacob L Is there a way to convert a customized notification into a standard notification or a toast using another app so then it can be interacted with through macrodroid?
No (not possible) and no (I don't think it's possible, best you can do is use OCR but that's just too complicated).
 

aitn

Member
No (not possible) and no (I don't think it's possible, best you can do is use OCR but that's just too complicated).
How can you use OCR when in DND mode it's not showing? I thought that Macrodroid has already built in function to find all text on the screen
 

Dimlos

Well-known member
The easy way is to change the DND settings to display the notification.
 

Attachments

  • DND.jpg
    DND.jpg
    91.1 KB · Views: 6
  • option.jpg
    option.jpg
    66.7 KB · Views: 6

aitn

Member
The easy way is to change the DND settings to display the notification.
Change it to what? It's not clear from looking at your screenshots... I don't want notifications to show all the time while on DND, I just want to inactivate it temporarily while this macro is being triggered.

There is no way to turn DND mode off action or write secure setting with Macrodroid other than using UI Interaction to open settings to turn it off?
 

Dimlos

Well-known member
I need a trigger to turn DND on and off, but I can't think of a way to do it because I don't see any notifications and it doesn't wake from sleep.
Displaying notifications on the DND should not be a problem, as there is no sound or vibrate activation.
 

aitn

Member
Displaying notifications on the DND should not be a problem, as there is no sound or vibrate activation.
Yes, but it could interfere with other Macrodroid UI interaction based macros...

Here is one example:

 

aitn

Member
If notifications are decorated instead of normal text, they are often not operable in MacroDroid.
The developer of the application may have wanted to make the notification easy to read, but it becomes an obstacle for automatic processing.
I'm having the same issue with the app, but yesterday I was able to get it to interact with the notification and answer and I'm 100% sure about that.
But today, it's failing with "Cannot invoke action 2:
java.lang.ArraylndexOutOfBoundsException: length=1; index=1"

Any idea what's going on? I think my Macrodroid is broken for Notification Interaction... Either that or my Android started to generate non standard notifications for apps that Macrodroid can't handle. I tried to reboot the phone, but that didn't fix it.
 
Last edited:

Dimlos

Well-known member
Please show me a screenshot of what kind of notification it is.
The Moto G Pure is not very powerful, so it may be prone to glitches.
It is important to disable battery optimization, although it is basic.
 
Top