cybex-dev / twilio_voice

Flutter Twilio Voice Plugin
https://twilio-voice-web.web.app/
MIT License
39 stars 78 forks source link

[Question][Android] How to use another plugin that handles FCM notifications (awesome_notifications or firebase_messaging with flutter_local_notifications) #193

Open katphlab opened 8 months ago

katphlab commented 8 months ago

Issue Summary

I have integrated the plugin in my app and everything is working as expected. But if I try to send a custom FCM notification to the app, that notification is captured by the plugin and doesn't reach Awesome_notifications plugin. This is mainly to do with this code.

      <service
            android:name="com.twilio.twilio_voice.fcm.VoiceFirebaseMessagingService"
            android:exported="false"
            android:stopWithTask="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

Steps to Reproduce

  1. Use the plugin in any application.
  2. Add the notification handling plugin. In my case awesome_notifications and awesome_notifications_fcm plugin
  3. Send a non-twilio FCM notification using admin_sdk
  4. Log prints D/VoiceFirebaseMessagingService(11750): onMessageReceived: The message was not a valid Twilio Voice SDK payload, continuing...
  5. Awesome_notifications is not triggered

Is there any known method to overcome this limitation?

The workaround that I can think of would be to create another methodChannel that will receive the entire FCM payload and manually trigger the VoiceFirebaseMessagingService.

cybex-dev commented 8 months ago

Hi @katphlab

Thank you for bringing this to my attention - I'll investigate and report back.

katphlab commented 6 months ago

I have created a fix for this by implementing the showBackgroundCallUI function and using the twilio payload to call the Twilio SDK.

212