現在、私はNotificationCompatがアイコンではなく、リソースIDのsetSmallIconをサポートしていないという事実に起因し、このWETコードがあります。setSmallIcon(アイコン:アイコン)とNotificationCompat
val notification = if (Build.VERSION.SDK_INT < 23) {
NotificationCompat.Builder(this)
.setLargeIcon(bitmap)
.setSmallIcon(R.drawable.ic_launcher)
.setContentText(intentDescriber!!.userFacingIntentDescription)
.setContentTitle(label)
.setContentIntent(contentIntent)
.setAutoCancel(true)
.build()
} else {
Notification.Builder(this)
.setSmallIcon(Icon.createWithBitmap(bitmap))
.setLargeIcon(bitmap)
.setContentText(intentDescriber!!.userFacingIntentDescription)
.setContentTitle(label)
.setContentIntent(contentIntent)
.setAutoCancel(true)
.build()
}
は作るための方法はあります
IconクラスはSDK 23で導入されました。したがって、compatはそれをサポートしていません。 – lionscribe
しかし、それはビットマップを取ることができます23インプットでは、このSDKレベル以上のためにアイコンを使用してビットマップをラップすることができます – ligi
あなたはいつも独自のビルダークラスを作ることができます... – lionscribe