I’m familiar with mobile, whatever @VinistoisR is trying to do is what I’d like to do as well.
How are you jumping directly to the specific camera view in HA? I can only figure out how to go to a “dashboard” in HA, not the actual live view. I think this is a limitation.
However, for jumping directly to Unifi Protect I think they have some protected adb intents. Jumping directly to a camera activity seems to result in a permission denial / security exception
./adb.exe shell am start -n com.ubnt.unifi.protect/com.ubnt.activities.timelapse.CameraActivity
Starting: Intent { cmp=com.ubnt.unifi.protect/com.ubnt.activities.timelapse.CameraActivity }
Exception occurred while executing 'start':
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.ubnt.unifi.protect/com.ubnt.activities.timelapse.CameraActivity } from null (pid=15243, uid=2000) not exported from uid 10340
at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1043)
at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:999)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:669)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1096)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1068)
at com.android.server.am.ActivityManagerService.startActivityAsUserWithFeature(ActivityManagerService.java:3662)
at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:544)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:186)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10505)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5053)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2867)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)
However, when issuing
./adb.exe shell am start -n com.ubnt.unifi.protect/com.ubnt.sections.splash.SplashActivity
Starting: Intent { cmp=com.ubnt.unifi.protect/com.ubnt.sections.splash.SplashActivity }
This results in opening the Unifi Protect app’s last activity, which if the last thing you were on was the main activity, or a live camera view, it will be that.
Sending this as a HA notification would be the following, but it appears that you can lose the specific activity addition and just call on the app as the URI (https://companion.home-assistant.io/docs/notifications/actionable-notifications#android-example)
service: notify.mobile_app_pixel_3
data:
message: 'test'
data:
actions:
- action: "URI"
title: "Open Unifi"
uri: 'app://com.ubnt.unifi.protect'
According to the HA docs, actionable notifications only show two examples: URI / URL
However, it appears if you change the action using the following example, you can achieve specific intents to launch into apps with: https://companion.home-assistant.io/docs/notifications/notification-commands/#broadcast-intent
automation:
- alias: Send broadcast intent
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
message: "command_broadcast_intent"
title: "action"
data:
channel: "com.ubnt.unifi.protect"
I’ve tried executing the above action FROM the notification shade via the android app, but I am afraid the android app doesn’t support this kind of response. If you wanted a specific intent, you’d probably have to send an action to your HA instance, which then would reply via an automation. However, I couldn’t get this to work as I think you need to be part of the correct “category” for the action, which the HA android app doesn’t allow doing via actions at the moment.
service: notify.mobile_app_pixel_3
data:
message: command_broadcast_intent
title: android.intent.action.MAIN
data:
channel: "com.ubnt.unifi.protect/com.ubnt.sections.splash.SplashActivity"
Spent a few hours looking at this for fun this morning. Hope this is helpful