diff --git a/android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java b/android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java index 62c79abe5c98e31386d8232d0e704b94b1a89fde..3c6da1b63a1504d670812799e39babe242463f5d 100644 --- a/android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java +++ b/android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java @@ -133,6 +133,28 @@ public class FIRLocalMessagingHelper { notification.setStyle(new NotificationCompat.BigTextStyle().bigText(bigText)); } + //picture + String picture = bundle.getString("picture"); + if(picture!=null){ + NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle(); + + if (picture.startsWith("http://") || picture.startsWith("https://")) { + Bitmap bitmap = getBitmapFromURL(picture); + bigPicture.bigPicture(bitmap); + } else { + int pictureResId = res.getIdentifier(picture, "mipmap", packageName); + Bitmap pictureResIdBitmap = BitmapFactory.decodeResource(res, pictureResId); + + if (pictureResId != 0) { + bigPicture.bigPicture(pictureResIdBitmap); + } + } + bigPicture.setBigContentTitle(title); + bigPicture.setSummaryText(bundle.getString("body")); + + notification.setStyle(bigPicture); + } + //sound String soundName = bundle.getString("sound", "default"); if (!soundName.equalsIgnoreCase("default")) {