Fix long notification with images conflict 2

This commit is contained in:
estevez-dev 2020-07-08 18:01:22 +03:00
parent d94cdf0d1b
commit 2126bc4f02

View File

@ -106,12 +106,13 @@ public class MessagingService extends FirebaseMessagingService {
.setAutoCancel(autoCancel)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
Bitmap image;
if (URLUtil.isValidUrl(imageUrl)) {
Bitmap image = getBitmapFromURL(imageUrl);
if (image != null) {
notificationBuilder.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(image).bigLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.blank_icon)));
notificationBuilder.setLargeIcon(image);
}
image = getBitmapFromURL(imageUrl);
}
if (image != null) {
notificationBuilder.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(image).bigLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.blank_icon)));
notificationBuilder.setLargeIcon(image);
} else {
notificationBuilder.setStyle(new NotificationCompat.BigTextStyle()
.bigText(messageBody));