Actionable notifications in Android app version 1.6.0

Goodmorning!

How can i enable the actionable notifications in de android app?
The documentation about de notifications is only for IOS.

2 Likes

It’s not possible yet to sens actionable notification with the android app.

The new functions sector is telling something else:

  • New: Actionable Notifications.
  • New: Request location update via push notification
  • Expand widget to allow passing more than just entity ids.
  • Full-screen notch fixes
1 Like

Ou wow that’s nice, didn’t see that one yet (was only released yesterday as far as I can see). However I can imagine that it works the same way as with the IOS app. Will for sure test this myself, was waiting for this :slight_smile:

This PR shows some examples on how to do it, I tested it and I can confirm it works.

1 Like

Yes tried this and it seems to work.
There seems to be maximum 3 action, my 4:th one dont show up.

message: This is a actionable notification test message!
title: Test notification
data:
  actions:
  - action: trigger_1
    title: T1
  - action: trigger_2
    title: T2
  - action: trigger_3
    title: T3
  - action: trigger_4
    title: T4

Automation to react on the triggers.

automation:
  - alias: React on notification trigger 1
    trigger:
    - event_data:
        action: trigger_1
      event_type: mobile_app_notification_action
      platform: event
    action:
      - service: persistent_notification.create
        data:
          message: This was Trigger 1
          title: Test notification
          notification_id: 1234
  - alias: React on notification trigger 2
    trigger:
    - event_data:
        action: trigger_2
      event_type: mobile_app_notification_action
      platform: event
    action:
      - service: persistent_notification.create
        data:
          message: This was Trigger 2
          title: Test notification
          notification_id: 1234
  - alias: React on notification trigger 3
    trigger:
    - event_data:
        action: trigger_3
      event_type: mobile_app_notification_action
      platform: event
    action:
      - service: persistent_notification.create
        data:
          message: This was Trigger 3
          title: Test notification
          notification_id: 1234
4 Likes

Has this update broken anyone else’s notifications where an image is used?

Previously I was using the following structure

    - service: notify.all_mobile
      data:
        title: "Text"
        message: "Message"
        data:
          android:
            notification:
              image: "ImageURL"

This no longer works correctly with 1.6 installed - I see the image but no title or text.

Some messing around in services shows that this works:

    - service: notify.all_mobile
      data:
        title: "Text"
        message: "Message"
        data:
          android:
            notification:
              title: "Text"
              body: "Message"
              image: "ImageURL"

Before I start re-working all my automations to resolve this, have I missed something obvious?

Took a quick look at the code and it only supports 3 actions.

This must be a new bug, the first massage and title will not show in the notification, but it seems there have to be atleast a message before the data:

Yeah, I’ve added my comments to the issue on github:

EDIT looks like my notifications were incorrectly setup initially - see my post below

Has anyone been able to have both actions and an image?

From comments on the github issue I linked to:

title: 'Title Text'
message: 'Body Text'
data:
  actions:
    - action: test
      title: Click Me
  data:
    image: 'imageUrl'

I’d set my image related notifications up incorrectly (using unsupported elements) is why mine broke with this app update.
I’ve now adjusted them using the above example (minus actionable elements as I need to plan them out for now) and everything is functioning as expected on my system.

EDIT

using

data:
   data:  
       image: 'imageURL'

not working as of Mon am UK time, now using:

title: 'Title Text'
message: 'Body Text'
data:
    image: 'imageUrl'

Excellent news, should be able to ditch fcm-android now and just have a single notification system.

Edit: Works a treat, just remember to open the app once on the relevant device after updating or it won’t work.

This worked for me:

message: "Alert"
title: "test"
data:
  actions:
    - action: "TEST"
      title: "click me"
  image: "https://i.pinimg.com/originals/0f/7b/fa/0f7bfa4e6775b5977694a6036fc85b48.png"
2 Likes

Nice … my previous non-functioning actions (from HTML5 Push) are now working with just changing the event type.

A huge nice addition to the android app, was just puzzling when you use a data_template in your automation. The best part of all: if I forward the notification to my Galaxy Watch Active 2, I can also start the action from the watch :smiley:

1 Like

Just in case anyone needs it, the formatting for a actionable notification if you are using node-red is:

{
    "message": "Did you feed the cats!",
    "title": "Feed the cats",
    "data": {
        "actions": [
            {
                "action": "cat_yes",
                "title": "Yes"
            },
            {
                "action": "cat_no",
                "title": "No"
            }
        ]
    }
}
8 Likes

Thanks for this! I just realized the actions work on my Fitbit Versa 2 as well!

1 Like

Any pointers on how to fetch the response of the action in Node-Red? I have an “events: all” node in my flow, but i don’t see anything returning from my android phone in the debugger, so i have no clue on how to trigger anything based on the selected action in the notification…

i got it working. I had set the “events all” listener to “mobile_app_notification_action” and send the output to a debug node so i could see the actual payload. I could then use a switch that listens to the msg.payload.event.action and create my triggers to the different action messages

1 Like