GitLiveApp / firebase-kotlin-sdk

A Kotlin-first SDK for Firebase
https://gitliveapp.github.io/firebase-kotlin-sdk/
Apache License 2.0
1.15k stars 156 forks source link

No method to receive Firebase Message / Notification #623

Open rupakTj opened 2 months ago

rupakTj commented 2 months ago

Firebase Messaging does not provide any method to receive the incoming message / notification.

Do not have any method like override fun onMessageReceived(message: RemoteMessage) provided by FirebaseMessagingService

Is there any other way to receive the messages/notifications.

mr-kew commented 1 month ago

I use platform specific code for that. See #467

rupakTj commented 1 month ago

Yes, I have used the same [https://search.maven.org/artifact/dev.gitlive/firebase-messaging/2.1.0/pom](Firebase Messaging library), but this lib only contains methods for fetching token, subscribe/unsubscribe topics.

But there is method to receive message. Am i missing anything?.

mr-kew commented 1 month ago

I am now not sure if I understood the question correctly.

What i meant is that you can obtain the native firebase messaging inside you iosMain (for example) by doing:

val messaging = Firebase.messaging.ios

// You can then proceed to handle the notifications as you would do in swift.

messaging.delegate = this

But this library (even in its native form) is not meant to receive notifications directly. You are just meant to register your app to receive notifications from Firebase. The receiving & displaying itself is handled by the respective os (that means in iosApp).

rupakTj commented 1 month ago

thanks @mr-kew for the guidance. Yes in the native layer it can be done,

but it would have been great for one stop solution if this library can provide the message receive part as well.