exponea / exponea-flutter-sdk

MIT License
7 stars 9 forks source link

Is there a way to have at least 2 different sources of push notifications? #20

Closed YaroslavSiniugin closed 8 months ago

YaroslavSiniugin commented 8 months ago

The first source is Exponea (pushes get delivered by APN) The second is my backend (pushes get delivered by FirebaseMessaging)

Right now there is only the first source in my app. I use ExponeaFlutterAppDelegate like this: image

And I want to add another source of push notifications. I'm going to use FirebaseMessaging to deliver pushes from my server. I'm going to modify my code like this: image

I'm wondering how I can combine 2 sources at the same time? So if the push belongs to Exponea then I don't have to do anything additional to handle it (just use the current implementation). Otherwise, if the push doesn't belong to Exponea then I want to listen to pushes somewhere in the dart code by using FirebaseMessaging.onMessage() or FirebaseMessaging.onMessageOpenedApp()

any help would be appreciated. Thank you

roland-misica commented 8 months ago

Hi, thanks for asking. Yes, there is a possibility to have multiple push notification providers, but the implementation on the app side is little tricky. There are no such callbacks to listen to for received push notifications on Flutter Exponea SDK, so you need to implement that to send them to flutter/dart code. Also Combining this plugin with FirebaseMessaging is not necessary, you can just modify your FirebaseMessagingService on Android platform and AppDelegate by overriding ExponeaFlutterAppDelegate's methods. Hope this helps.

Regards