Changing the Application ID on Android TV Lovelace cards

We use the Android TV Remote integration (Android TV Remote - Home Assistant) as our dog ate our remote. For simplicity’s sake, I recreated the same remote interface. Unfortunately ADB access is not possible. Considering that almost everything is customizable in HA, I thought it must be possible to rename the Application ID (e.g. com.google.android.tvlauncher) to a more legible one by providing a list and replacing the values.

I know this might be a silly thing, but I know if its bothering me, its bothering someone else.

1 Like

In short no. It would require a rebuild of the app.

If you want to know where the appID (R id) comes from: ApplicationId versus PackageName - Android Studio Project Site

I don’t want to seem like I am fighting, but this seems like an arbitrary limitation within HA. I can specify a variable in python and PowerShell to replace basic text wherever it is called, can this not be done in HA? I will say I am very new to HA and Linux overall, but I have quite a bit of knowledge in windows systems.

It’s not a HA limitation it’s a limit of how apps are built It would work the same on Windows as well. The item you’re looking for is compiled I the actual executable and in the app manifest. It’s designed to be immutable for a specific app for a reason.

You basically are saying the equivalent of well ok I know your name is Joe but I need you to put whiteout on your birth certificate and call yourself Ron for me. K?

I know this is a bit older now. But what I’m thinking, there has to be a way of creating a table and saying “if I see this, then change it to that”. More like saying “I know your name is Joseph, but I’m gonna call you Joe”

If you can figure that out report it to Google as a security vulnerability. :wink:

I know this topic is quite old now, but if you want to display app name (e.g. YouTube) instead of app package name (e.g. com.google.android.youtube.tv) on Media control card you can do this with media_player.template integration. You can install it with HACS or manually.

The integration allows to set custom media player title via title_template configuration variable. You can conditionally set desired app name based on app package name exposed by Android TV remote media player.

Below is a code snippet you can add to your configuration.yaml file. Just change media_player.android_tv to your Android TV media player entity and add conditions for other Android apps installed on your TV in title_template. You can also configure other variables based on your needs.

media_player:
  - platform: media_player_template
    media_players:
      android_tv_template:
        friendly_name: Android TV
        device_class: tv
        value_template: >
          {% if is_state("media_player.android_tv", "on") %}
            on
          {% else %}
            off
          {% endif %}
        title_template: >
          {% if is_state_attr('media_player.android_tv', 'app_id', "com.netflix.ninja") %}
            Netflix
          {% elif is_state_attr('media_player.android_tv', 'app_id', "com.google.android.youtube.tv") %}
            YouTube
          {% else %}
            Android TV
          {% endif %}
        turn_on:
          service: media_player.turn_on
          target:
            entity_id: media_player.android_tv
        turn_off:
          service: media_player.turn_off
          target:
            entity_id: media_player.android_tv
        volume_up:
          service: media_player.volume_up
          target:
            entity_id: media_player.android_tv
        volume_down:
          service: media_player.volume_down
          target:
            entity_id: media_player.android_tv
        mute:
          service: media_player.volume_mute
          target:
            entity_id: media_player.android_tv
        play:
          service: media_player.media_play
          target:
            entity_id: media_player.android_tv
        pause:
          service: media_player.media_pause
          target:
            entity_id: media_player.android_tv
        stop:
          service: media_player.media_stop
          target:
            entity_id: media_player.android_tv
        next:
          service: media_player.media_next_track
          target:
            entity_id: media_player.android_tv
        previous:
          service: media_player.media_previous_track
          target:
            entity_id: media_player.android_tv

After adding this to your configuration.yaml file and restarting Home Asisstant you should have media_player.android_tv_template entity, that shows currently opened app name on Media control card.