Use the method setLargeIcon(Bitmap?) instead of setLargeIcon(Icon?) because it may scale the Bitmap on versions before API 27. Starting in API 27, the framework does this automatically.

This commit is contained in:
Benoit Marty
2025-11-13 11:41:11 +01:00
parent 8878c9595a
commit f0ec0164ef

View File

@@ -11,7 +11,6 @@ package io.element.android.libraries.push.impl.notifications.factories
import android.app.Notification
import android.content.Context
import android.graphics.Bitmap
import android.graphics.drawable.Icon
import androidx.annotation.ColorInt
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationCompat.MessagingStyle
@@ -215,9 +214,7 @@ class DefaultNotificationCreator(
if (openIntent != null) {
setContentIntent(openIntent)
}
if (largeIcon != null) {
setLargeIcon(Icon.createWithBitmap(largeIcon))
}
setLargeIcon(largeIcon)
setDeleteIntent(pendingIntentFactory.createDismissRoomPendingIntent(roomInfo.sessionId, roomInfo.roomId))
// If any of the events are of rtc notification type it means a missed call, set the category to the right value