I can see that
public void onMessageReceived(RemoteMessage remoteMessage)
is called when receiving push (when app is in background)
But it is not displaying any UI for the push notification.
I want something like the following
I think I've seen more than dozen SO questions, most notably the following one, but like I mentioned onMessageReceived
is already getting called, just UI is not displaying.
How to handle notification when app in background in Firebase
My code for displaying
ui for push is the following, do I need to do extra other than this?
Notification notification = notificationBuilder.build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
JSONObject push = notificationArgsObj.optJSONObject("push");
if(push != null) {
String sound = push.optString("sound");
if(sound.equals("default")) {
notification.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
}
}
notificationManager.notify(destination_id, notification);