Commit d1cd4014 authored by Libin Lu's avatar Libin Lu Committed by GitHub

Merge pull request #406 from XeniousSoftware/master

added big picture style to android notification
parents 9296ffc4 6f0f32c3
......@@ -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")) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment