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

That command can only happen from the app in the car and not the phone side. Needs a different context.

Thanks for you answer, make sense. Do you know the correct context?

Like I said above only available to the car app.

Sorry for misunderstanding, Is there a different way to achieve the goal?

So the issue here is that for one there is no package_name for CarContext like you have. CarContext is only available when our AA app has started however that context is not passed down to other elements of the app. In fact as soon as you disconnect from AA its completely gone.

Now for the workaround/what to actually do. Did you ever notice in AA that if you have your phone out and start navigation from your phone that AA picks that up and starts navigating? Noticed this last week and its pretty nice, just use provided example in the docs to start navigation on the phone, when connected to the car so it can begin.

https://companion.home-assistant.io/docs/notifications/notification-commands#activity

Thanks! Will give that a go soon, also looking into the option to do something similar with non Google maps navigation.

Next to that work-around, would it be possible in the future that Home Assistant can support something like this? So instead of pressing the location in the Navigation menu in Android Auto, you could trigger this with an automation (with the condition Android Auto is connected)

If so, where is the best place to ask for the feature?

Anyway thanks for your help, learned a lot!

Ummm this notification command is meant to be used in an automation. It gets processed as soon as the device receives the notification.

Hi all!

I’m experimenting with the potential of command notifications. In particular, trying to control Youtube Music playback.

I got quickly to play and pause through this:

service: notify.mobile_app_XXX
data:
  message: command_media
  data:
    media_command: play_pause
    media_package_name: com.google.android.apps.youtube.music

However i can’t find the way to skip to next or previous song.

Any help? Can someone tell me where should i search?

Thanks a lot!

Did you manage to find the intents for DS Cam in the mean time?

No, i stopped using it, the intent i needed to open a camera view instant was not avaible, its not possible with DS Cam to open a stream from an intent

Did you figure this out? I want to do something similar.

you need to format the URI like Google’s own example

hi, this will souns strange but… has anyone tested the ACTION_DELETE i want to delete my apps, since the place where i live has become dangerous… and when some people take your phone ask you nicely to unlock it and give the access to your apps etc… i have a lil bluetooth smart button with me and it let me send some intents, but now im looking for a way to uninstall/delete my bank/social media apps so has anyone try or have been used the action_delete?

what you actually want is ACTION_UNINSTALL_PACKAGE

https://developer.android.com/reference/android/content/Intent#ACTION_UNINSTALL_PACKAGE

this will not work without code changes to the app, if you really need something like this then please open a feature request on github for the team to look into. The app will need to request new permissions that it currently does not request. Also the method is deprecated and the recommended approach would actually be a new notification command that is not an intent.

One other thing to keep in mind is that it may require user confirmation before removing as no 3rd party apps qualify for the permission that works without confirmation.

https://developer.android.com/reference/android/Manifest.permission#DELETE_PACKAGES

this may not fit your exact use case but worth discussing in a request if you think it will work.

wow thanks for answer me so fast… yes i would like to open a feature request on github… wich one of the repositories will be the right one to as for something like this?

Hello,

Some context : By sharing a youtube link or a google map address to my tesla app, it will open the app on the tesla

I’m trying to send the correct event from my companion app without success for now.

Here is (one of) my attempt so far :

service: notify.mobile_app_cph2415
data:
  message: command_broadcast_intent
  data:
    intent_package_name: com.teslamotors.tesla
    intent_action: android.intent.action.SEND
    intent_extras: >-
      TEXT:{{ 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' | urlencode
      }}:String.urlencoded

I’ve also tried to send this to home assistant in order to debug without being in my car, but i’m not sure that an app sending itself an intent is supposed to work (i observed mobile_app.share events).
Here is some variation i’ve tried

service: notify.mobile_app_cph2415
data:
  message: command_broadcast_intent
  data:
    intent_package_name: io.homeassistant.companion.android
    intent_action: io.homeassistant.companion.android.action.SEND
    intent_extras: >-
      SUBJECT:coucou:String,TEXT:{{
      'https://www.youtube.com/watch?v=dQw4w9WgXcQ' | urlencode
      }}:String.urlencoded

other attempts : EXTRA_TEXT instead of TEXT, with SUBJECT or EXTRA_SUBJECT.

by looking at this snippet : Sharing - Tesla JSON API (Unofficial) i think there is some interresting hints

share_ext_content_raw
android.intent.extra.TEXT

i’ve searched quite a lot arround tasker(lots of examples) and tesla app intents, without much success, this is why i’m trying to use the SEND intent that seems to be the default one receving, at least it is what companion app uses to receive shares : https://github.com/home-assistant/android/blob/b3b74fae0e86e1763761113b444d4e9129c3375a/app/src/main/java/io/homeassistant/companion/android/share/ShareActivity.kt#L33

i’ve also atempted some decompiling : com.teslamotors.tesla_4.28.2-2157-2157_minAPI24(arm64-v8a,armeabi-v7a,x86_64)(nodpi)_apkmirror.com.apk/AndroidManifest.xml - Decompiler.com
to understand the activities and intents, but without success for now.

Is this feasible, can someone help me ?
Thanks !

Made some progress, sharing for others :slight_smile:

After analyzing the AndroidManifest of the tesla App, i’ve been able to send this event succesfully, resulting on an automatic navigation start on the Tesla

service: notify.mobile_app_cph2415
data:
  message: command_activity
  data:
    intent_package_name: com.teslamotors.tesla
    intent_action: android.intent.action.VIEW
    intent_uri: >-
      geo:0,0?q={{ 'Tesla, 45500 Fremont Blvd, Fremont, CA 94538, United States'|urlencode }}

some docs on how to write geo uri : Google Maps Intents برای اندروید  |  Maps URLs  |  Google for Developers

relevant sections of the AndroidManifest (full version here)

<activity android:theme="@style/AppFullScreenTheme" android:name="com.tesla.share.ShareActivity" android:exported="true" android:configChanges="keyboard|keyboardHidden|orientation|uiMode|screenSize">
    <intent-filter>
        <action android:name="android.intent.action.SEND"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <data android:mimeType="text/plain"/>
        <data android:mimeType="text/x-vcard"/>
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="geo"/>
    </intent-filter>
</activity>

No success for now to send links, but i’ll keep you posted. (unless someone has a brilliant idea :magic_wand: )

Hi, i’m trying to get an android intent trigger sent from my android tv when I’m switching inputs from the physical remote.
Is this possible?

Here are intents for the each hdmi input I’m using in ha

HDMI 1

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHDMI100004

HDMI 2
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW6

HDMI 3
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW7

HDMI 4

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW8

Or would I need to install additional app on the tv like automate app to send triggers to ha?

have you attempted to convert this? you already have the intent action and the data/URI to be sent with the intent. You’ll have to do some trial and error to see what works. Refer to the docs to see the best way to translate it.