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

Hello,

I am trying to start and stop Focus Mode using intent on my phone.
I found a reddit reporting there are intents available in Digital Wellbeing, which is the application Focus Mode is part of.
I tried with this action in a script:

service: notify.mobile_app_matteo_mobile
data:
  message: command_broadcast_intent
  data:
    intent_package_name: com.google.android.apps.wellbeing
    intent_action: com.google.android.apps.wellbeing.action.FOCUS_MODE
alias: Intent test

This should open the settings for Focus Mode, but it doesn’t work.
I followed the instructions to receive intents in Companion App and created the automation reported in the first post to show the intent received, but I receive no notification when I run the action.

Did anyone tried anything similar?

Thank you

Might be helpful to show the article you found containing the intent so others can investigate

Here it is

And sorry for the late reply

try commad_activity instead of command_broadcast_intent

Hi @dshokouhi, your solution did the trick for the sample action I posted, but my intention were to start Focus Mode depending on time, date and events.
The actions in the reddit seem to do the trick, but how should I configure my script?

Thank you

You’re going to have to do some trial and error with things to make it work as you desire.

So I’m trying to get Home Assistant to automatically trigger something whenever I loose Bluetooth connection to my car. I’m not able to Trigger on connected_paired_devices and From: since it returns a list. I don’t want it to trigger every time my BT status change on my phone only when I loose connection to my car.

So I thought I’d send an Intent with Tasker? But I have no Idea on where to start and how I get Home Assistant-app to register the Intent and send it to my server.

1 Like

I’m able to open a specific list/note in Google Keep, using Tasker:

Send Intent
Action: "android.intent.action.VIEW"
Data: "https://keep.google.com/u/0/#LIST/LISTID" #found by accessing Google keep, with a browser, and taking note of the url of a specific list
Package: "com.google.android.keep"
Target: Activity

What would be the best way to apply this with notify?


Edit:

Ok, so it was intent_uri…

Exemple:

service: notify.mobile_app_mobilename
data:
  message: command_activity
  data:
    intent_package_name: com.google.android.keep
    intent_action: android.intent.action.VIEW
    intent_uri: https://keep.google.com/u/0/#LIST/LISTID

Edit2:

Unfortunately its not practical to auto-open the shopping list in Google Keep, as the update location - even when using the zone with the park lot added - simply takes to long to change.

I would already be returning to the car when the location changed.

Hei guys!
Is it possible to send an intent to android companion to quit itself, or at last go to android home screen ?

this is not a good idea it will kill the sensor worker and you wont see periodic updates.

looks like the app needs to support intent categories which it currently does not. So you can in the meantime send the intent for the app for tasker to pick up and perform the desired steps. Feel free to submit a feature request to add support for intent categories to do this directly

Ref: android - Going to home screen programmatically - Stack Overflow

1 Like

Hi,
I no longer get value data in android intents. I used to read the value of battery from my mi band using Notify for mi band app Tasker integration. I believe it started to occur after updating HA Companion App, which is reading android intents from Notify for mi band. Any hints how to solve the problem?

more than likely the issue is with the mi band notify app, check that it is still sending the intents we do print the intents to the logs too

Notify for mi band app is sending correct intent. I checked it with tasker, which can receive value of the battery…

check the companion app logs at the same time to see what the issue is

There is no android intents about battery or heartrate in the logs… How can I find out what the issue is?
Edit: Checked again with refreshed logs and there are android intents about mi band battery, but again with no value…

What about a template trigger?

trigger:
  - platform: template
    value_template: "{{ 'xx:xx:xx:3C:BB:AC (Seat BT )' not in state_attr('sensor.YOURPHONE_bluetooth_connection', 'connected_paired_devices') }}"

You have to look how your device is named in the attributes, for me it is the mac adress and the name of my car.
Everytime it connects the bt the template will render to false and when disconnects it will fire and do your action.

Feel free to file an issue with the proper logs so we can investigate

I don’t have time to file a proper issue just now, but I do think this broke recently. I’m seeing a lot of errors in the companion app log like “Key max_charging_voltage expected String but value was a java.lang.Integer”, and all of the values for intents are empty by the time they reach HA (presumably because of the type error).

yes this was fixed recently in https://github.com/home-assistant/android/pull/3825 will be in the next beta push this Saturday

Hi,

I’m looking into making an automation for Android Auto when it’s connected it should start the navigation to a specific location based on the time. In the Android Auto HA app there is a way to start navigation to saved locations, but how to automate it?

I was looking into the Android Intent documentation and I think it should be possible but unfortunately no success.

service: notify.mobile_app_sm_s901b
data:
  message: "command_activity"
  data:
    car_ui: true
    intent_package_name: "androidx.car.app.CarContext"
    intent_action: "androidx.car.app.action.NAVIGATE"
    intent_uri: "geo:51.43974395527734,5.47861250945549"