Open Assist on Android via the notify service

Hi,
I am trying to open the Assist activity on Android by sending a notification like this, but it’s not working:

service: notify.mobile_app_<...>
data:
  message: command_broadcast_intent
  data:
    intent_package_name: "io.homeassistant.companion.android"
    intent_action: "android.intent.action.ASSIST"

Any ideas?

Hello,

Works with that :slight_smile:

service: notify.mobile_app_xxx
data:
 message: "command_activity"
 data:
  intent_package_name: "io.homeassistant.companion.android"
  intent_action: "android.intent.action.ASSIST"
2 Likes

You da best! Must’ve overlooked that part of the docs.

1 Like

Hi guys, I’m trying to do this but get an error message

Unable to send activity intent, please check command format

I have searched left and right but cannot find a reason for this.
Any help is highly appreciated!

Post your code here.

service: notify.mobile_app_tab
data:
  message: command_activity
  data:
    intent_package_name: io.homeassistant.companion.android
    intent_action: android.intent.action.ASSIST

HA 2023.11.3, everything up-to-date
App 2023.10.2
Also added quotes but it’s the same and they get removed when switching between visual editor & YAML

The format is correct. I checked the code here. It seems this error is shown when there is an ActivityNotFoundException. The exact exception is logged through ADB logs. If you can capture them on the Android device, I can take a closer look.
One more thing, make sure you grant the HA app the “Display over other apps” permission from the Android device’s settings.

Hi @backslashv, thank you for helping!

The HA app has the permission to display over other apps, so that’s OK.
From the app logs:

--------- beginning of main
11-25 18:33:44.858  3258 15289 I System.out: [socket]:check permission begin!
11-25 18:33:44.866  3258 15290 I System.out: [socket]:check permission begin!
11-25 18:33:45.813  3258 15211 I SensorReceiver: Sensor updates and sync completed
11-25 18:34:35.803  3258  3258 E GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
11-25 18:34:40.094  3258  3273 I android.minima: Background concurrent copying GC freed 100339(4208KB) AllocSpace objects, 2(104KB) LOS objects, 49% free, 6013KB/11MB, paused 144us total 386.076ms
11-25 18:34:42.472  3258  3258 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@f23b678
11-25 18:34:42.668  3258  3258 E GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
11-25 18:34:43.594  3258 15247 I SensorReceiver: Sensor updates and sync completed
11-25 18:34:50.428  3258  3273 I android.minima: NativeAlloc concurrent copying GC freed 98235(4325KB) AllocSpace objects, 29(644KB) LOS objects, 49% free, 6197KB/12MB, paused 194us total 429.266ms
11-25 18:35:13.002  3258  3258 W android.minima: Accessing hidden method Landroid/view/WindowInsets$Builder;->setVisible(IZ)Landroid/view/WindowInsets$Builder; (blacklist, linking, denied)
11-25 18:35:13.007  3258  3258 W android.minima: Accessing hidden method Landroid/view/Window;->getInsetsController()Landroid/view/WindowInsetsController; (blacklist, linking, denied)
11-25 18:35:13.008  3258  3258 W android.minima: Accessing hidden method Landroid/view/WindowInsets;->isVisible(I)Z (blacklist, linking, denied)
11-25 18:35:13.009  3258  3258 W android.minima: Accessing hidden method Landroid/view/WindowInsets;->getInsets(I)Landroid/graphics/Insets; (blacklist, linking, denied)
11-25 18:35:13.009  3258  3258 W android.minima: Accessing hidden method Landroid/view/WindowInsets$Builder;->setInsets(ILandroid/graphics/Insets;)Landroid/view/WindowInsets$Builder; (blacklist, linking, denied)
11-25 18:35:13.010  3258  3258 W android.minima: Accessing hidden method Landroid/view/WindowInsets$Type;->systemGestures()I (blacklist, linking, denied)
11-25 18:35:13.011  3258  3258 W android.minima: Accessing hidden method Landroid/view/WindowInsets$Type;->mandatorySystemGestures()I (blacklist, linking, denied)
11-25 18:35:13.011  3258  3258 W android.minima: Accessing hidden method Landroid/view/WindowInsets$Type;->tappableElement()I (blacklist, linking, denied)
11-25 18:37:47.751  3258  3258 E GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
11-25 18:37:55.853  3258  3258 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@2b1606a
11-25 18:37:56.010  3258  3273 I android.minima: Background young concurrent copying GC freed 74506(4489KB) AllocSpace objects, 30(664KB) LOS objects, 37% free, 7728KB/12MB, paused 128us total 110.708ms
11-25 18:37:56.175  3258  3258 E GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
11-25 18:37:56.322  3258  4938 W IMGSRV  : glGetString:4370: Override GL_RENDERER PowerVR SGX Clark 
11-25 18:37:56.357  3258  4938 W IMGSRV  : glGetString:4370: Override GL_RENDERER PowerVR SGX Clark 
11-25 18:37:56.724  3258  3258 E WebviewActivity: Cannot set status bar color. Skipping coloring...
11-25 18:37:56.724  3258  3258 E WebviewActivity: Cannot set navigation bar color. Skipping coloring...
11-25 18:37:56.739  3258 15487 I System.out: [socket]:check permission begin!
11-25 18:37:58.861  3258 15216 I WebViewPresenterImpl: Found color -16537100.
11-25 18:37:58.866  3258 15216 I WebViewPresenterImpl: Found color -328966.
11-25 18:38:06.669  3258  3258 E MessagingService: Unable to send activity intent please check command format
11-25 18:38:06.669  3258  3258 E MessagingService: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.ASSIST flg=0x10000000 pkg=io.homeassistant.companion.android }
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2058)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.app.Instrumentation.execStartActivity(Instrumentation.java:1716)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.app.ContextImpl.startActivity(ContextImpl.java:958)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.app.ContextImpl.startActivity(ContextImpl.java:929)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.content.ContextWrapper.startActivity(ContextWrapper.java:383)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at io.homeassistant.companion.android.notifications.MessagingManager.processActivityCommand(MessagingManager.kt:1734)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at io.homeassistant.companion.android.notifications.MessagingManager.handleDeviceCommands(MessagingManager.kt:703)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at io.homeassistant.companion.android.notifications.MessagingManager.access$handleDeviceCommands(MessagingManager.kt:101)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at io.homeassistant.companion.android.notifications.MessagingManager$handleMessage$4.invokeSuspend(MessagingManager.kt:425)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.os.Handler.handleCallback(Handler.java:883)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.os.Handler.dispatchMessage(Handler.java:100)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.os.Looper.loop(Looper.java:214)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at android.app.ActivityThread.main(ActivityThread.java:7405)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at java.lang.reflect.Method.invoke(Native Method)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:502)
11-25 18:38:06.669  3258  3258 E MessagingService: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
11-25 18:38:06.709  3258  3258 E GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
11-25 18:38:16.319  3258  3258 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@4d152e1
11-25 18:38:16.409  3258  3258 E GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
11-25 18:38:16.661  3258 15497 I System.out: [socket]:check permission begin!
11-25 18:38:16.661  3258 15498 I System.out: [socket]:check permission begin!
11-25 18:38:17.091  3258  3273 I android.minima: Background young concurrent copying GC freed 58776(2811KB) AllocSpace objects, 33(852KB) LOS objects, 30% free, 8547KB/12MB, paused 426us total 140.171ms
11-25 18:38:17.268  3258 15211 I SensorReceiver: Sensor updates and sync completed

So it’s that:

11-25 18:38:06.669  3258  3258 E MessagingService: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.ASSIST flg=0x10000000 pkg=io.homeassistant.companion.android }

Is there something that is missing maybe or not correctly configured in my setup?

Not sure what’s causing the error. There hasn’t been any changes to the intent handling of the assist activity since the 10.2 stable release of the app (I’m on 11.3 beta). Maybe try

  1. without providing the package name. On my device, it will ask to choose between HA, Google, and Tasker.
  2. uninstalling and reinstalling the app.
  3. opting into beta

[EDIT] One more thing. “android.intent.action.ASSIST” was added in API level 16 aka Android Jelly Bean. Maybe your tablet is prehistoric? :smiley:

1 Like

Are you using the minimal version of the app? If so then your package name is slightly different, add .minimal to the end for the correct package name

2 Likes

Thank you Daniel, very much! :bowing_man:
That was it → minimal

Sorry for hijacking this topic guys but since the issue was solved anyway I thought that I could find help here (which worked out) and didn’t want to create another topic.

Thanks a lot guys, wonderful community!

@backslashv just a suggestion: if you mark this topic as solved, it will be even more valuable to others.

Didn’t even know a minimal version exists. This thread doesn’t have a “mark as solved” button.

There you go: you learned something new too! :wink:

Also not by selecting the three dots under the post:

image

Then there should be a check box:

image

No, it’s not showing for some reason.

@tom_l or @petro or @Tinkerer: how is this possible?

Let me look into that, it’s likely some weird Discourse setting.

1 Like

That’ll work now, this section didn’t have the option enabled (and now I’ll go check the rest of the forum).

1 Like