Developing companion app for the Android TV integration

Hello everyone.

I’m thinking of developing companion app for Android TV, that would bring local push notifications to the androidtv (currently, androidtv integration constantly polls, which is wasteful and slow. App would be running directly on the Android TV, detect system events and transmit them to the HA directly in real time).

I’ve talked to the maintainer of the androidtv integration and he likes the idea. But currently I’m thinking on what would be the best way to get this app to the users of the integration.

My idea currently is that, since androidtv integration already uses ADB bridge that can install other apps, integration would include the companion app in its files and it would automatically install it to the Android TV and configure it (pass HA token etc.) whenever it connects to the Android TV.

Would this approach (including binary of the otherwise open-source app and automatically installing it to the user’s device) be okay with the Home Assistant?

3 Likes

I know that androidtv is not precisely the same as android, but there might be a lot in the android companion app that is usable.

I feel like projects want to achieve very different purpose.

Android app:

  • Gives user full access to the Lovelace (which requires touch / mouse that many Android TV devices do not have)
  • Requires user to login with his/hers full HA login (which is cumbersome on many Android TV devices where only input is navigating through the keyboard via D-pad on the remote)
  • Has to balance sending updates to HA with battery consumption on the phone (and thus updates may be delayed)

Android TV helper app would:

  • Not have any UI at all
  • Ideally login automagically via integration (integration would generate token and send it via ADB to automate setup)
  • Not care much about battery life, since Android TV devices are usually plugged into the wall, and thus can provide instant media playback state updates (not sure if regular Android app even has media player component)

Of course the two could be merged together, but I feel it would involve way more work than just creating this small companion separately.

2 Likes

@matejdro I know this is an old post but curious if you ever had gotten around to putting something together. I’ve tried the Home Assistant companion Android app APK on my Bravia including a “light” version but navigation doesn’t work and can’t get past the login screen. Right now I’m (trying to) use Fully Kiosk that’s an Android TV version but it’s not keeping me logged in when the app closes and can’t navigate anywhere with remote, not sure if connecting a mouse would work or not.

Would love to find something that’ll display dashboards on several televisions and can’t cast to them all.

Yes, here it is: GitHub - matejdro/AndroidTVRefresher: Small Android TV utility app that pushes updates to the Home Assistant's Android TV integration in real time.

But it does not display dashboard, it only refreshes androidtv integration, as described in the first post.

1 Like

@matejdro is it possible to also push current app to HA?

I can’t use “IME” option in Android tv remote on my two shields, because otherwise I can’t use Gboard.

Androidtv integration already exposes current app:

Yes, sort of.
Just when you have the IME option enabled in the integration.
But sadly than i have the documented bug:

Here is an excerpt:

Some onscreen keyboards enabled by TV manufacturers do not support concurrent virtual and onscreen keyboard use. This presents whenever a text field is selected, such as “search” where a constant use the keyboard on your mobile device will show, preventing you from opening the onscreen keyboard to type. This can be overcome by either disabling your 3rd party keyboard and using the default Gboard keyboard or by deselecting Enable IME in the Configure page of the integration.

I am using the integration with my two “NVIDIA Shield Pro 2019” and facing this “bug” when enabled the IME option. So i cant use it to get the current “app_id”.

Which android TV do you use?

Sorry, I’m not sure. This app is only for dynamically refreshing existing data coming from androidtv integration.

1 Like