FCM notifications triggered from the backend aren’t received on certain user accounts, regardless of Android or iOS, in messaging services.
In the Android messaging service,
class R2RFirebaseMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {
if (remoteMessage.data.isNotEmpty()) {
sendNotification(messageBody = remoteMessage.data)
}
}
override fun onNewToken(token: String) {
saveRegistration(token)
}
private fun saveRegistration(token: String) {
// TODO: Implement this method to send token to your app server.
}
private fun sendNotification(messageBody: MutableMap<String, String>) {
// TODO: Implement this method to set push notification.
}
}
It is triggered only in some accounts while in others no message is received in some accounts,
the saveRegistration() method saves the Firebase token to backend.
What is the issue at hand and is there any solution?