[firebase_messaging]: Messaging stopped working properly after firebase update
Is there an existing issue for this?
- [X] I have searched the existing issues.
Are you aware of the differences between iOS and Android background message handling?
- [X] I understand that iOS and Android background messages behave differently, and I've designed my application with that in mind.
Do you have an active Apple Developer account?
- [X] I have an active Apple Developer account.
Are you using a physical iOS device to test background messages?
- [X] I am 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?
Have you created an APNs key in your Apple Developer account & uploaded this APNs key to your Firebase console?
Have you disabled method swizzling for Firebase in your app?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>CatedralApp</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>catedralapp</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.730634363046-ibebsa45r1d8v889vt1smtivfp64475g</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>BundleID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.pmf.catedralappios</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-1785464071070677~7221440751</string>
<key>GIDClientID</key>
<string>730566337046-ibebsa45r1d8v889vt1smtivfp04233g.apps.googleusercontent.com</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>sms</string>
<string>tel</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We need to access your location while the app is in the background, This will allow CatedralApp to give you instructions and record your tracks even when your phone is in your pocket.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>We need to access your location while the app is in the background. This will allow CatedralApp to give you instructions and record your tracks even when your phone is in your pocket.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need to access your location in order to show your position on the resort map.</string>
<key>PermissionGroupNotification</key>
<string>Notification</string>
<key>NSMicrophoneUsageDescription</key>
<string>The application does not use this permission</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>fetch</string>
<string>location</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>FirebaseDynamicLinksCustomDomains</key>
<array>
<string>https://catedralapp.com.ar/shares</string>
</array>
<key>FirebaseDeepLinkPasteboardRetrievalEnabled</key>
<false/>
<key>FirebaseAutomaticScreenReportingEnabled</key>
<false/>
</dict>
</plist>
Are you sending messages to your app from the Firebase Admin SDK?
def enviarTest():
msg = messaging.Message(topic='test', data={
'foo': 'bar', 'topic': 'test'}, apns=messaging.APNSConfig(
payload=messaging.APNSPayload(
aps=messaging.Aps(content_available=True)),
),)
messaging.send(msg)
return None
Have you requested permission from the user to receive notifications?
- [X] I have the relevant permission 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?
Im attaching different cases:
- With BOM 1.1.0, background message correctly delivered to app link to content
- With BOM 2.0.0, foreground message is not delivered link to content
- With BOM 2.0.0, background message is not delivered link to content
- With BOM 2.0.0, if I add badge to the message, foreground is delivered but background not link to content
Additional context and comments
Im using firebase messaging in a flutter app. Everything works fine (foreground and background messages are correctly received) if I revert to versions from 2024-05-28 - [BoM 1.1.0]
However if I go to a version equal or greater than 2024-06-04 - [BoM 2.0.0] messaging stops working, both foreground and background. I have found that foreground works if I add a badge number to the message, but I dont understand why.
Background messages are not delivered to the app even when badge is present. I have tried both with and without setting content_available=True. In BOM 1.1.0 works fine regardless of this setting, and in BOM 2.0.0 and above does not deliver the background messages at all.
Regards
Eventough the messages are received at first with BOM 1.1.0 both in foreground and background, after some time of being in background the messages are not delivered anymore. May be a battery protection in iOS.
Same issue facing while trying to send notification from flutter client(Android), iOS client, firebase cloud function using admin SDK. All were working few days back, suddenly stoped working.
@mdrakib19 Did you upgrade firebase packages before that started to happen?
I have the same problem: notifications were working fine the last few days, but now my app isn't receiving notifications on either iOS or Android.
can you switch content_available=True to content-available=1 for iOS
@pamafe1976 no I didn't. It's suddenly stopped working. I was using legacy API to send the push from the clients. Now I am switching to cloud function and sending push using admin SDK and it's working. I guess legacy API stopped working and we have to switch V1.
I have the same problem: notifications were working fine the last few days, but now my app isn't receiving notifications on either iOS or Android.
Same here!
@Luismi74 https://firebase.google.com/docs/cloud-messaging/migrate-v1
I believe I reported similar problem, here are my findings: https://github.com/firebase/flutterfire/issues/13350
looks like all tokens, created with version < 15.0.0 stopped working. And we are not using legacy API, even Firebase Messaging "Send test message" feature is not working properly with tokens generated with SDK <15.0.0. It is really suprising for me, I do believe it is a huge inpact.
Enable method Swizzling for iOS did the trick for me!
<key>FirebaseAppDelegateProxyEnabled</key> <false/>
I'm unable to reproduce this on firebase_messaging 15.1.2. Kindly bump your firebase_messaging version and try again. I'll be awaiting feedback.
I'm unable to reproduce this on
firebase_messaging15.1.2. Kindly bump your firebase_messaging version and try again. I'll be awaiting feedback.
~~It still doesn't work for me.~~
~~Same issue as @pamafe1976.~~
~~For me, after updating to Xcode 16, my project can't build with BoM 1.1.0. Therefore, I had to upgrade Flutter to version 3.24 and use BoM 2.8.0. However, after that, Messaging stopped working.~~
~~I have two MacBooks with different Xcode versions. On Xcode 15, BoM 1.1.0 works fine with FCM.~~
After I reset my iPhone to factory settings, itβs working now (tested on iOS 18.1 DB4, though Iβm not sure why it works).
I have some Firebase Messaging push campaigns that stopped working as well since 16th September.
Is there any way to solve this for users in production?
I had a similar problem. In my spring service, I upgraded the firebase version in Pom from 9.1.1 to 9.2.0 and when sending messages to firebase, I changed the method from sendAllAsync to sendEachAsync and notifications started arriving. Maybe this will help someone.
Also having issues with newer versions of firebase_messaing. Not 100% sure my issue is the same or related though. I've only tested iOS 18 devices.
iOS Flutter app with BoM 2.4.1 works, any later versions doesn't work. The biggest change made in later versions is switching from iOS SDK 10.29 (used in BoM 2.4.1) to iOS SDK 11.0 (used in BoM 2.5.0) A major version jump of the iOS SDK that seems to have broken something between firebase_messaging 15.0.4 and 15.1.0.
Disabling method swizzling and adding the following to AppDelegate.swift makes it work, but I don't want to do that since it's not recommended.
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken;
}
I'm unable to reproduce this on
firebase_messaging15.1.2. Kindly bump your firebase_messaging version and try again. I'll be awaiting feedback.
Hi @SelaseKay, I have tested once again just in case, updating firebase_messaging to 15.1.3 I confirm that after the update, the messages are not being received anymore in IOS, both in foreground or background. Android keep working with no issue.
If I go back to firebase_messaging 14.9.4, messages are received perfectly in both platforms, both in foreground and in background.
We are experiencing the same issue when using the messaging.send(msg) with no Notification.title. We would still receive messages for Android and Web, but not iOS.
As a workaround we now use a MulticastMessage and specify a title, eg.
var message: MulticastMessage = {
notification: { title: '...' },
data: {
...
},
tokens: [{fcmToken}]
};
await getMessaging().sendEachForMulticast(message)
At least this works for us now.
Hi @minusoneman,
If you include the notification field in messaging.send does it work on IOS? I cant use MulticastMessage because I need to send the message to a topic.
Regards
@pamafe1976 We didn't test messaging.send() with notification.title. We already had MulticastMessage working in our app, so we just changed our server functions to only use MulticastMessage and that worked so we left it at that. It would be interesting to test, though.
it work if change back to old version ` firebase_messaging: 14.9.4
firebase_core: 2.32.0
cloud_firestore: 4.17.5
firebase_storage: 11.7.7 `
@mminhlequang Yes, it works fine when reverting to old version. Thats the reason I opened the issue.
Good be great to have someone in the Firebase team look into this to find out if something was inadvertenly broken at some point.
@pamafe1976 We didn't test messaging.send() with notification.title. We already had MulticastMessage working in our app, so we just changed our server functions to only use MulticastMessage and that worked so we left it at that. It would be interesting to test, though.
Including notification title would not be an option in my case, since the notification would be shown to the user by the OS, and I want the message to be invisible to the user, because it contains data that is to be processed by the app.
Hey @pamafe1976, I have a fix for background message handling in iOS that should allow you to turn FirebaseAppDelegateProxyEnabled back to true.
Could you try this branch: https://github.com/firebase/flutterfire/pull/13525, and let me know if it works for you?
Thanks π
Hey @pamafe1976, I have a fix for background message handling in iOS that should allow you to turn
FirebaseAppDelegateProxyEnabledback to true.Could you try this branch: #13525, and let me know if it works for you?
Thanks π
HI @russellwheatley
Your PR seems to solve the issue. πͺ I have tested my case with your branch, and the messages arrive correctly in IOS, both in foreground and background. Hope it is merged asap!
Regards & Thank you
Hi, is there any news about the new version release? I need to use the previous major firebase_messaging version to get push notifications to work properly.