*** Solved thanks to Ben's answer****.
I have to change "NAVIGATION" for "POI" in manifest.
Original question:
I'm working on an "update" of may Android APP to include "Android auto" service for maps. I have tested in DHU and on real device (a car) and everything works fine, but when I wan to launch "google maps" or another "maps app", this code should open it, but it doesn't work. No error but "maps app" doesn't start.
This is the code that I use, into a "onclick element", based on the docs https://developer.android.com/training/cars/apps#user-interaction
var myCoordinates = latitude "," longitude
val intent = Intent(CarContext.ACTION_NAVIGATE, Uri.parse("geo:" myCoordinates))
carContext.startCarApp(intent)
)
This is my "manifest" (android auto part)
// 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"/>
**** solution *****
</intent-filter>
</service>
// android auto
Any special element that is mandatory in "manifest" to open it properly?
Thanks in advance
CodePudding user response:
The most recently used navigation app is the one that is used to handle the CarContext.ACTION_NAVIGATE
intent. I haven't tried it myself but I would suspect that, if your app is categorized as a navigation app, it is the one receiving the intent.