1、在对应工程的manifest里添加支持Androidauto的注册信息:
<application>
...
<meta-data android:name="com.google.android.gms.car.application" android:resource="@xml/automotive_app_desc"/>
...
<application>
其中automotive_app_desc.xml路径为res/xml/下,信息内容如下:
<automotiveApp>
<uses name="media"/>
</automotiveApp>
2、在工程的manifest里声明media browser service,内容例如:
<application>
...
<service android:name=".MyMediaBrowserService" android:exported="true">
<intent-filter> <action android:name=
"android.media.browse.MediaBrowserService"/> </intent-filter>
</service>
...
<application>
3、如果需要通知,可以在manifest里添加对应的通知内容,例如:
<application>
...
<meta-data android:name="com.google.android.gms.car.notification.SmallIcon" android:resource="@drawable/ic_notification" />
...
<!--如果要支持搜索,需要添加搜索消息-->
<activity> <intent-filter>
<action android:name= "android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<category android:name= "android.intent.category.DEFAULT" />
</intent-filter&g