Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample code dont work #27279

Closed
askthomas opened this issue May 5, 2023 · 12 comments · Fixed by #28620
Closed

Sample code dont work #27279

askthomas opened this issue May 5, 2023 · 12 comments · Fixed by #28620
Labels
integration: androidtv_remote Stale The PR had no activity for quite some time, and is marked as Stale

Comments

@askthomas
Copy link

Feedback

Copied sample code, but the link to start YouTube ect, the TV say no app to handle that,

URL

https://www.home-assistant.io/integrations/androidtv_remote/

Version

2023.5.1

Additional information

Using Google Chrome Cast TV 4K

@home-assistant
Copy link

home-assistant bot commented May 5, 2023

Hey there @tronikos, mind taking a look at this feedback as it has been labeled with an integration (androidtv_remote) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of androidtv_remote can trigger bot actions by commenting:

  • @home-assistant close Closes the feedback.
  • @home-assistant rename Awesome new title Renames the feedback.
  • @home-assistant reopen Reopen the feedback.
  • @home-assistant unassign androidtv_remote Removes the current integration label and assignees on the feedback, add the integration domain after the command.

@tronikos
Copy link
Member

tronikos commented May 6, 2023

Does the following work?
youtube://play

@bbayu123
Copy link

bbayu123 commented May 6, 2023

I also have a Chromecast with Google TV, I can help answer that.
No it does not work.

I was also hoping that the value in the current_activity attribute would work, so I tried com.google.android.youtube.tv, that also does not work.

@tronikos
Copy link
Member

tronikos commented May 6, 2023

If you can get a copy of the APK follow the guide at https://community.home-assistant.io/t/android-tv-remote-app-links-deep-linking-guide/567921 and update the wiki there.

@askthomas
Copy link
Author

askthomas commented May 6, 2023 via email

@bbayu123
Copy link

bbayu123 commented May 6, 2023

TL;DR: The activity to use on Chromecast with Google TV is vnd.youtube:// or vnd.youtube.launch://


Details:
Alright, I have good news.
Instead of following your guide, I tried connecting my Chromecast with Google TV (CCWGTV), and accessing it directly using adb. I was looking at some commands related to listing the packages on the my CCWGTV, and found a dump command: adb shell cmd package dump PACKAGE

So I did adb shell cmd package dump com.google.android.youtube.tv, and it gave me something like this

Command output (First 51 lines)

DUMP OF SERVICE package:
Activity Resolver Table:
  Schemes:
      vnd.youtube:
        66fd601 com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity filter 3bc3294
          Action: "android.intent.action.VIEW"
          Action: "android.media.action.MEDIA_PLAY_FROM_SEARCH"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "vnd.youtube"
          Scheme: "vnd.youtube.launch"
      http:
        66fd601 com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity filter d1976e7
          Action: "android.intent.action.VIEW"
          Action: "android.media.action.MEDIA_PLAY_FROM_SEARCH"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "http"
          Scheme: "https"
          Authority: "youtube.com": -1
          Authority: "www.youtube.com": -1
          Authority: "m.youtube.com": -1
          Authority: "youtu.be": -1
          Path: "PatternMatcher{GLOB: .*}"
      https:
        66fd601 com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity filter d1976e7
          Action: "android.intent.action.VIEW"
          Action: "android.media.action.MEDIA_PLAY_FROM_SEARCH"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "http"
          Scheme: "https"
          Authority: "youtube.com": -1
          Authority: "www.youtube.com": -1
          Authority: "m.youtube.com": -1
          Authority: "youtu.be": -1
          Path: "PatternMatcher{GLOB: .*}"
        66fd601 com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity filter 102d13d
          Action: "com.google.android.gms.cast.tv.action.LAUNCH"
          Category: "android.intent.category.DEFAULT"
          Scheme: "https"
          Authority: "www.youtube.com": -1
          Path: "PatternMatcher{GLOB: .*}"
      vnd.youtube.launch:
        66fd601 com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity filter 3bc3294
          Action: "android.intent.action.VIEW"
          Action: "android.media.action.MEDIA_PLAY_FROM_SEARCH"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "vnd.youtube"
          Scheme: "vnd.youtube.launch"

This appears to be similar to the information that the guide leads you to obtain.
Following the first activity resolver, it is a scheme of vnd.youtube or vnd.youtube.launch with no other information. So I have tested both vnd.youtube:// and vnd.youtube.launch://, and they both appear to work.

For those figuring out what to put in the activity field, and have access to your device, a computer with the Android debug bridge, and a cable to connect the two together (or if the device allows it, wireless debugging), then you can see if the steps above work for you.

One more thing, if you are struggling to find the package name, the name inside the "current_activity" attribute is the package name. Or alternatively, you might be able to find it in adb shell cmd package list packages.

Now, regardless of the method you choose, I don't think it works with every single app. I tried doing the same thing with VLC Media Player, and I cannot get it to launch no matter what I try.

@meierthomas
Copy link

I can verify this; i.e. vnd.youtube:// works for me as well (didn't work before).

Tried the same approach to figure out Netflix --> scheme nflx and netflix and so I tried nflx:// and netflix:// and both didn't work:

  • nflx:// resulted in unknown for the activity;
  • netflix:// started Netflix but I still can't navigate within the app

@bbayu123
Copy link

bbayu123 commented May 7, 2023

The scheme nflx shows up as

      nflx:
        48b6cc6 com.netflix.ninja/.MainActivity filter bdb3320
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Scheme: "nflx"
          Authority: "www.netflix.com": -1
          AutoVerify=true

So the link should be nflx://www.netflix.com/

As for navigation not working, it's not related to the deep link. The navigation keys available for use are DPAD_{direction} - the same for a gamepad direction button. And it seems (and I have verified with a bluetooth controller) that Netflix does not respond to gamepad directional button inputs. Joystick inputs do work with Netflix, and so do A and B buttons.

@meierthomas
Copy link

hmm, I don't really understand this as I was trying to map the YouTube example above with Netflix...

Given joystick inputs work is there a way to implement this for this integration?

@philpownall
Copy link

bbayu123,

I can confirm that the vnd.youtube.launch:// link works on my Chromecast (CCWGTV) from Home Assistant: now I can put TV commands into automations.

But here's a challenge for you - volume control/mute and TV input do not work (I think the Chromecast uses the HDMI-CEC feature to control the connected TV volume and inputs). So, what is the call service/command or adb command to send the mute command through HDMI-CEC to the TV connected to the Chromecast?

I looked in the service list and found:
hdmi_control: [android.hardware.hdmi.IHdmiControlService]

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved.
If this issue is still relevant, please let us know by leaving a comment 👍
This issue has now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale The PR had no activity for quite some time, and is marked as Stale label Jul 12, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2023
@meierthomas
Copy link

Not trying to let this issue close but if anyone has a solution to the Netflix issue (can start Netflix but can't use the remote within Netflix) I'd appreciate some advise on how you addressed it

@github-actions github-actions bot locked and limited conversation to collaborators Sep 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
integration: androidtv_remote Stale The PR had no activity for quite some time, and is marked as Stale
Projects
None yet
5 participants