I'm trying to create a messaging app to test Android Auto. However I can't get the notifications to show up on the DHU. I also tested with Facebook Messenger and there it works.
I went pretty much by the development guide here: https://developer.android.com/training/cars/messaging
Just added some hardcoded strings and icons etc. for testing. I have added the required lines to manifest.
AndroidManifest.xml:
<application
...
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc"/>
<service
android:name=".MessagingService"
android:exported="true"/>
...
</application>
This is invoked from a button press:
MessagingServiceKt.notify(
getContext(),
new YourAppConversation(
1337,
"Convo title",
new ArrayList<YourAppUser>(Arrays.asList(
new YourAppUser(
1234,
"Test1",
IconCompat.createWithBitmap(Bitmap.createBitmap(24,24,Bitmap.Config.ALPHA_8))
),
new YourAppUser(
5345,
"Test2",
IconCompat.createWithBitmap(Bitmap.createBitmap(24,24,Bitmap.Config.ALPHA_8)),
)
),
Bitmap.createBitmap(24, 24, Bitmap.Config.ALPHA_8)
)
);
Rest of the code looks pretty much the same as in the example, but with hardcoded data for the conversation, user and message objects.
I should be seeing the notification pop up on the DHU unit but it doesn't. I don't get any errors either and all the functions run without fail.