После создания канала уведомлений и уведомляющего компата для службы переднего плана на значке приложения отображается значок с 1. Вот код для создания канала и уведомления. Он успешно создан, и для Samsung Galaxy S10 я вижу значок #.
private fun createServiceNotificationChannel(context: Context): String {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
var channelId = ""
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
channelId = Constants.NOTIFICATION_SERVICE_CHANNEL_ID
val channel = NotificationChannel(channelId, "YDS", NotificationManager.IMPORTANCE_NONE).apply {
description = "Get notifications about trips"
}
channel.setShowBadge(false)
channel.lockscreenVisibility = Notification.VISIBILITY_PRIVATE
// Register the channel with the system
notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager?.createNotificationChannel(channel)
}
return channelId
}
fun buildNotification(message: String, title: String, context: Context) : NotificationCompat.Builder{
val channelId = createServiceNotificationChannel(context)
val notificationBuilder = NotificationCompat.Builder(context, channelId)
notificationBuilder.setOngoing(true)
.setSmallIcon(R.drawable.ic_notification_service)
.setContentTitle(title)
.setContentText(message)
.setPriority(NotificationCompat.PRIORITY_MIN)
.setCategory(Notification.CATEGORY_SERVICE)
return notificationBuilder
}
![enter image description here](https://i.stack.imgur.com/7LNSI.jpg)
Как мне его получить, чтобы значок # не отображается для службы переднего плана?
^. ^