Android Auto:如何在车载应用中通过坐标打开Google Maps(已解决)
Android Auto调用第三方地图无响应的解决方案
问题场景
为Android应用适配Android Auto地图服务时,DHU及实车测试中其他功能均正常,但通过代码触发打开Google Maps或其他地图应用时无任何反应——既无报错信息,目标应用也未启动。
触发代码
var myCoordinates = latitude + "," + longitude val intent = Intent(CarContext.ACTION_NAVIGATE, Uri.parse("geo:" + myCoordinates)) carContext.startCarApp(intent)
原Manifest中Android Auto配置片段
// android auto <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=".programameudisservice" android:exported="true"> <intent-filter> <action android:name="androidx.car.app.CarAppService" /> <category android:name="androidx.car.app.category.NAVIGATION"/>
解决方法
只需修改Manifest中<intent-filter>内的category值,将androidx.car.app.category.NAVIGATION替换为androidx.car.app.category.POI。
修改后的Manifest相关片段
</intent-filter> </service> // android auto
内容的提问来源于stack exchange,提问作者oscarabilleira
相关产品推荐
相关产品推荐

