Commit dc6722f3 authored by Varun Patil's avatar Varun Patil

Add support for large_content

parent 6b82e3fa
...@@ -39,6 +39,7 @@ public class Constants { ...@@ -39,6 +39,7 @@ public class Constants {
public static final String FCM_BUNDLE_VERB = "verb"; public static final String FCM_BUNDLE_VERB = "verb";
public static final String FCM_BUNDLE_IMAGE = "image_url"; public static final String FCM_BUNDLE_IMAGE = "image_url";
public static final String FCM_BUNDLE_LARGE_ICON = "large_icon"; public static final String FCM_BUNDLE_LARGE_ICON = "large_icon";
public static final String FCM_BUNDLE_LARGE_CONTENT = "large_content";
public static final String FCM_BUNDLE_ACTION_STARTING = "starting"; public static final String FCM_BUNDLE_ACTION_STARTING = "starting";
......
...@@ -78,16 +78,29 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService { ...@@ -78,16 +78,29 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
final String message = remoteMessage.getData().get(Constants.FCM_BUNDLE_VERB); final String message = remoteMessage.getData().get(Constants.FCM_BUNDLE_VERB);
/* Get unique id */
int notification_id = NotificationId.getID(); int notification_id = NotificationId.getID();
/* Default options */
NotificationCompat.Builder builder = standardNotificationBuilder()
.setContentTitle(remoteMessage.getData().get(Constants.FCM_BUNDLE_TITLE))
.setContentText(message)
.setContentIntent(getNotificationIntent(remoteMessage, notification_id));
/* Check for article */
String largeContent = remoteMessage.getData().get(Constants.FCM_BUNDLE_LARGE_CONTENT);
if (largeContent != null) {
builder.setStyle(new NotificationCompat.BigTextStyle()
.bigText(largeContent));
}
/* Get images and show */
showBitmapNotification( showBitmapNotification(
this, this,
remoteMessage.getData().get(Constants.FCM_BUNDLE_IMAGE), remoteMessage.getData().get(Constants.FCM_BUNDLE_IMAGE),
remoteMessage.getData().get(Constants.FCM_BUNDLE_LARGE_ICON), remoteMessage.getData().get(Constants.FCM_BUNDLE_LARGE_ICON),
notification_id, notification_id,
standardNotificationBuilder() builder,
.setContentTitle(remoteMessage.getData().get(Constants.FCM_BUNDLE_TITLE))
.setContentText(message)
.setContentIntent(getNotificationIntent(remoteMessage, notification_id)),
message message
); );
} }
......
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