简体   繁体   English

Android 自动应用程序未显示在物理设备上

[英]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).目前正在测试 Android Auto,我们现在正在物理设备(在汽车中)上进行测试。 So far I have managed to get add working Android Auto support to an app, where we are drawing some basic templates.到目前为止,我已经设法将工作 Android 自动支持添加到我们正在绘制一些基本模板的应用程序中。 This works on the emulated DHU and the app shows and can be used.这适用于模拟的 DHU 和应用程序显示并且可以使用。 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.我的应用程序当前显示在模拟的 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.作为控制测试,我通过 Android Studio 使用 > Automotive > Media Service 创建了一个新项目,只是为了确保它实际上可以在物理设备上进行测试。 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"?为什么应用在使用“android.media.browse.MediaBrowserService”时会显示物理设备,而在使用“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.如果我遗漏了某些内容或您需要更多详细信息,请告诉我。 ❤️ ❤️

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.答:为了在物理设备上进行测试,您需要启动内部测试轨道并接受 Android 自动附录。 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.为了让您的应用在真正的主机(不是我们提供的桌面主机)上运行,您的应用必须通过 Google Play 商店分发。 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.仍然不确定为什么示例项目会绕过这一点,但肯定是 Google 应用程序的某种白名单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM