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