When I send a notification to my Android device via the Firebase web interface, the notification does not look from the status bar. If I want to see a notification, I have to slip through. This happens even when my priority is set to High in the web interface. Why is this?
This is not a problem if a notification appears when the application is open, because I can set the priority in the FirebaseMessagingService class:
public class MyFirebaseMessagingService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); sendNotification("Message Body"); } private void sendNotification(String messageBody) { Intent intent = new Intent(this, SubscribedActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 , intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_push_notification) .setContentTitle("FCM Message") .setContentText(messageBody) .setAutoCancel(true) .setSound(defaultSoundUri) .setPriority(NotificationCompat.PRIORITY_MAX) .setColor(ContextCompat.getColor(this, R.color.color_accent)) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 , notificationBuilder.build()); } }
source share