Что я использую:
Код: Выделить всё
//create channel
private val channel = NotificationChannel(channelId, channelName,
NotificationManager.IMPORTANCE_NONE)
...
//Show the notification
val builder = NotificationCompat.Builder(carContext, channelId)
.setSmallIcon(iconId)
.setContentTitle(getString(contentStringId))
//Extend for Android Auto
.extend(
CarAppExtender.Builder()
.setSmallIcon(iconId)
.setContentTitle(getString(contentStringId))
.setImportance(NotificationManagerCompat.IMPORTANCE_HIGH)
.build()
)
with(NotificationManagerCompat.from(carContext)) {
notify(MapConstants.NOTIFICATION_ID_ALERT, builder.build())
}
Просто чтобы уточнить: если я устанавливаю первоначальную важность канала на ВЫСОКИЙ, это отображается как на мобильных устройствах, так и на автоматических устройствах.
Подробнее здесь: https://stackoverflow.com/questions/790 ... the-mobile
Мобильная версия