I have implemented FCM
. The messages are receiving in Android N
and lower devices.
dependency
implementation "com.google.firebase:firebase-messaging:17.1.0"
I have tried sending messages from firebase
console. It showing in Android N
but not in Android O
.
I have tried sending data notification from the server. Didn't got any call on onMessageReceived()
in Android O
.
Added channel while showing notification
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
// Since android Oreo notification channel is needed.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(channelId,
"CRW notification channel",
NotificationManager.IMPORTANCE_HIGH)
notificationManager.createNotificationChannel(channel)
}
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build())
I have checked this in Samsung S2
and One plus 6
.
Do I need to do anything extra for Android O
other than setting notification channel on showing the notification?