Android Intents - Sending & Receiving List (Starting Activities too!)

So one thing to keep in mind is that every intent action will have a different set of requirements which can vary from app to app. So while the SENDTO action does not need address as an extra, when using with the VIEW action the app may need to read it.

So using the direct example from @Hellis81 several posts above its working.

  message: "command_activity"
  data:
    intent_uri: "smsto:0123456789"
    intent_package_name: "com.google.android.apps.messaging"
    intent_action: "android.intent.action.VIEW"
    intent_extras: "address:0123456789,sms_body:TEST"

I really wish I could agree with you.

Why do you keep adding and changing things?
Now you have intent_type.

Just copy paste and replace the data part.
Or are you missing some permissions perhaps?

Because I’m trying to figure out why it’s not working? :man_shrugging:

yes, I did.

Because it was listed in the android docs linked above by dshokouhi. So I thought that might be the reason it wasn’t working because it was missing.

Now I don’t.

I did that originally as in my first post above about this.

this is exactly what I’m trying the last time (personal details redacted) and still not working:

service: notify.mobile_app_my_mobile_app
data:
  message: command_activity
  data:
    intent_uri: "smsto:2605667890"
    intent_package_name: "com.google.android.apps.messaging"
    intent_action: "android.intent.action.VIEW"
    intent_extras: "address:2605667890,sms_body:TEST"

I use the “command_activity” intent to make notifications, set my alarm clock, and set the ringer mode on the phone all the time. So I doubt it’s a permissions problem.

Unless I need to give it a permission for every different “command_activity” intent I use? But I don’t remember needing to do that after the very first time I used that intent.

nothing is popping up prompting me for permissions tho.

all I get is the above error each time I try it.

I would be surprised if there is not a different permission for writing sms.
The popup when you install apps list sms as one specific permission so that seems to suggest it’s a different permission

the only permission for command_activity is draw over other apps and if needed phone call permissions. The app will look for these things when attempting to send any command so we will prompt the user in this case. For SMS there is no special permission, and the app does not qualify to be a default SMS, given that it works for others the issue is probably something else.

@finity just for sanity sake do you indeed have the Google Messages app installed on the device? I ask because we are targeting that specific app per the provided package.

When you get the toast notification there is also an error printed in the companion app logs, that may give a clue if the actual package is installed so we can see why its failing.

I’ve looked but there is nothing that I can see that’s prompting me for a permission.

Well no I don’t actually have that app installed. :man_facepalming:

I just checked the app I do use and this should now be the correct app/command:

service: notify.mobile_app_my_mobile_app
data:
  message: command_activity
  data:
    intent_uri: "smsto:2605667890"
    intent_package_name: "com.samsung.android.messaging"
    intent_action: "android.intent.action.SENDTO"
    intent_extras: "sms_body:TEST"

and it seems to now be working. Thank you and pardon my dumbness. :crazy_face:

But the command just brings up the dialogue box to compose the text. I still have to hit send.

Is there a way to bypass that and send it directly without any interaction?

no the app does not qualify to be a default SMS app, unless you can find an intent like was done for making a phone call its probably not possible. I don’t see it specifically mentioned in the google docs I linked earlier either.

OK, thanks for your help.

1 Like

Has anyone managed to get the Intent URI for sending an SMS working for an actionable notification, rather than a command activity? I’ve tried to follow the android guidance for sending an SMS (which covers the same items listed in your example), but I can’t seem to get the format right as is needed for the notification.

Any help would be greatly appreciated :slight_smile:

Spent a few hours to make an intent which plays a song on Spotify (all solutions to this threat didn’t work):

service: notify.mobile_app_pixel_4_app
data:
  message: "command_activity"
  title: "open spotify"
  data:
    intent_extras: "android.intent.extra.focus:vnd.android.cursor.item/playlist,query:we will rock you"
    intent_package_name: "com.spotify.music"
    intent_action: "android.media.action.MEDIA_PLAY_FROM_SEARCH"
1 Like

unfortunately the solutions in this thread are at the mercy of app updates which can change what intents they accept at any time. I am glad you were able to figure it out, hopefully it helps the next person!

I don’t know if this is the right place for this question but I’ll give it a try.
I have registered the intent “io.homeassistant.companion.android.OPEN_DOOR” in the Home Assistant app via the Last Update Sensor.
If I send
message: "command_broadcast_intent" with
intent_package_name": "io.homeassistant.companion.android" and
"intent_action": "io.homeassistant.companion.android.OPEN_DOOR"
via the notify service, I also receive the corresponding event.

However, I would like to trigger the intent via the clickAction of a notification. For this I have set the following for the clickAction of my notifaction:
clickAction: "intent://open_door#Intent;package=io.homeassistant.companion.android;action=OPEN_DOOR;end"
but the event is not triggered when I click on the notification. Can anyone help me and advise me what I’m doing wrong?

I am not the best at building intent links but I can tell you that the action open_door is not in our manifest and will not do anything as a result. This page should guide you through it better.

https://developer.chrome.com/docs/multidevice/android/intents/

Thanks for your advice but seems like it’s not possible to use the notifaction clickAction intent URI together with the Last Update Sensor :frowning:

yea you will not be able to get an event sent back from the click action as it can be external to the app and we will not get notified. For that you need to use actionable notification.

I’ve been ‘playing’ with sending automation intents to Tasker and then I let Tasker do what’s needed.

The following is working perfectly and I simply set up a profile(intent received) in tasker to trigger when ‘plug_bulb_change’ is received.

action:

  • service: notify.mobile_app_oneplus_9_pro
    data:
    message: command_broadcast_intent
    data:
    intent_package_name: net.dinglisch.android.taskerm
    intent_action: plug_bulb_change
    mode: queued
    max: 10

This only creates a sms? It doesn’t send it does it?

no the app is not a SMS app so it cannot send, only compose.

1 Like