'Android Auto app doesn't show up on physical device

Currently testing Android Auto, where we are now testing on a physical device (in a car). So far I have managed to get add working Android Auto support to an app, where we are drawing some basic templates. This works on the emulated DHU and the app shows and can be used. The problem is that when we are testing on a physical device, it doesn't show up. My app currently shows up in the emulated DHU. All the necessary developer settings are turned on, so this shouldn't be an issue.

As a control test I created a new project through Android Studio by using > Automotive > Media Service, just to make sure that it was actually possible to test on a physical device. With no modifications and a clean install on a device, the car recognizes the app and the app is available in the car through a cable connection (physical device).

I suspect there is something I am overlooking in the different manifests.

This is the shared manifest for the project app:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.itf_aa.shared">
    
    <application>
        
        <meta-data
            android:name="com.google.android.gms.car.application"
            android:resource="@xml/automotive_app_desc" />
        
        <meta-data android:name="androidx.car.app.minCarApiLevel"
            android:value="1" />

        <service
            android:name="com.example.itf_aa.shared.MainGridService"
            android:exported="true">
            <intent-filter>
                <action android:name="androidx.car.app.CarAppService" />
            </intent-filter>
        </service>

    </application>

</manifest>

Meanwhile this is the shared manifest of the control app:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication.shared">

<application android:appCategory="audio">

    <meta-data
        android:name="com.google.android.gms.car.application"
        android:resource="@xml/automotive_app_desc" />

    <!-- Main music service, provides media browsing and media playback services to
     consumers through MediaBrowserService and MediaSession. Consumers connect to it through
     MediaBrowser (for browsing) and MediaController (for playback control) -->
    <service
        android:name="com.example.myapplication.shared.MyMusicService"
        android:exported="true">
        <intent-filter>
            <action android:name="android.media.browse.MediaBrowserService" />
        </intent-filter>
    </service>

</application>

I suspect the problem is found in the intent filter, where seems to be the difference maker. Does anyone know if there is anything else I can use in the intent filter or how my manifests may be wrong? This is the only thing I suspect being the difference maker, as I don't see how the app category makes it any different. Why does the app show up physical devices when we use "android.media.browse.MediaBrowserService", but not when we use "androidx.car.app.CarAppService"?

I am grateful for any help I might get on this, so thank you for your time and help in advance. If I left something out or you need more details, let me know. ❤️



Solution 1:[1]

Turns out the answer can be found here.

Answer: in order for testing on physical devices, you need to start an internal test track and accept the Android Auto addendum. Then deploy the test through the Developer Console.

In order for your app to run on a real head unit (not the desktop head unit we provide), your app must be distributed through the Google Play Store. This ensures that your application has been tested and vetted for adherence to our guidelines. These guidelines ensure that your application is relevant to the car environment, as well as pass our driver distraction tests.

It had nothing to do with the manifests. Still not sure why sample projects bypass this, but must be some sort of whitelist for Google apps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1