Our app is going to support Android Auto. We have a navigation button on car screen. When user press that button, we want to open Google Map directly for navigation (on car screen, not on app).
Here's my code:
val uri = Uri.parse("geo:0,0?q=${latitude},${longitude}(${name})")
val intent = Intent(CarContext.ACTION_NAVIGATE, uri)
intent.setPackage("com.google.android.apps.maps")
carContext.startCarApp(intent)
This is the part of "manifest" for 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"/>
</intent-filter>
</service>
// android auto
Now when I have other app can handle this intent, such as the navigation app or showcase app of android auto sample project, it will start navigation with other apps sometimes.
Does anyone know how to explicitly open Google Map for navigation on car screen?