Android Auto POI app notifications not displaying on car screen (Not using MessagingStyle)



I am developing an Android app belonging to the POI (Point of Interest) category using the Android for Cars App Library. I want to show a push notification to drivers on Android Auto when a relevant event triggers.
Because this is a POI app and not a chat/messaging app, I am explicitly not using NotificationCompat.MessagingStyle, nor am I providing "Reply" or "Mark as Read" actions.
Instead, I am trying to push a standard heads-up alert using the code below, but the notification never appears on the Android Auto head unit screen (though it shows up fine on the phone's notification shade).

val notification = NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_poi_alert)
.setContentTitle("Sample app")
.setContentText("Testing")
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setOngoing(false)
// Extend the notification for Android Auto
.extend(
CarAppExtender.Builder()
.setContentTitle("Sample app")
.setContentText("Testing")
.setSmallIcon(R.drawable.ic_poi_alert)
.setAction(pendingIntent) // Main click action inside the car
.build()
)
.build() notificationManager.notify(NOTIFICATION_ID, notification)

When I implement NotificationCompat.MessagingStyle along with the required (but hidden) "Reply" and "Mark as Read" action objects, the notification successfully appears on the Android Auto head unit. Could someone please clarify if Android Auto strictly restricts notifications to MessagingStyle only, or is there a way to display standard notifications for other app categories.

-1
Nov 3 at 1:52 AM
User Avatarandroidmaster
#android#kotlin#android-auto

No answer found for this question yet.