I have an application that should display a heads-up notification when the application is in the foreground and in the background (not in history).
In the case of the foreground, I got this using the following method.
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx); builder.setFullScreenIntent(pendingIntent,true);
But in the background, it is always displayed in the notification area. Someone will tell you how to do this in the background (not in history).
I tried the following options for notification, but did not work.
{ "to" : "_Token_", "priority":"high", "data": { "title": "Test", "text": "Fcm" }, "notification": { "title": "Test", "text": "Fcm" } }
android firebase-cloud-messaging
SachinS
source share