firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.66k stars 3.96k forks source link

[firebase_messaging] : iOS background message handling with call kit (app is in terminated state) #13037

Open HarshitaRawat1 opened 3 months ago

HarshitaRawat1 commented 3 months ago

Is there an existing issue for this?

Are you aware of the differences between iOS and Android background message handling?

Do you have an active Apple Developer account?

Are you using a physical iOS device to test background messages?

Have you enabled "Remote Notifications" & "Background Mode" (Checking options for "Background Processing" & "Remote Notifications") in your app's Xcode project?

I have enabled "Remote Notifications" & "Background Mode"

Have you created an APNs key in your Apple Developer account & uploaded this APNs key to your Firebase console?

Uploaded APNs key in apple developer account

Have you disabled method swizzling for Firebase in your app?

Yes

Are you sending messages to your app from the Firebase Admin SDK?

Yes

Have you requested permission from the user to receive notifications?

Have you used the 'Console' application on your macOS device to check if the iOS device's system is throttling your background messages?

Yes

Additional context and comments

For the latest version i.e. 15.0.2, I am not able to show calling using flutter incoming call kit

russellwheatley commented 3 months ago

Hey @HarshitaRawat1 - could you describe what the problem is and how to reproduce, please?

HarshitaRawat1 commented 3 months ago

I have a calling functionality in my app, So i m using flutter_callkit_incoming: ^2.0.4+1 for displaying incoming calls. So it's working fine in foreground but not displaying when the app is in background state or terminated.

Here is how we are handling it in background:

@pragma('vm:entry-point') Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { await Firebase.initializeApp(); await showCallkitIncoming(uuid.v4(), callData: message.data); }

I am facing this issue only in IOS, it's working in android. This was working completely fine when I was using the 14.8.0 for firebase_messaging and 2.28.0 for firebase_core, but after updating these dependencies to the latest version this issue arose.

russellwheatley commented 3 months ago

Is the message not coming through to the background handler? have you tested that yourself?

i.e. run in flutter run --release and add print statement to check. I have tested on iOS and it worked for me.

sharis-nectar commented 2 months ago

I am also facing the same issue in iOS background handler is not giving anything at all. In android it is working fine. @russellwheatley I tried "flutter run --release" still the issue is there

HarshitaRawat1 commented 2 months ago

I have tried "flutter run --release" still the issue is there

t-kob commented 2 months ago

When calling the API, it might be good to set "contentAvailable: true".