I was testing FCM for flutter on an iOS device, i followed the guides and i can successfully send notification to my iOS device, the problem is that when i touch the notification neither onResume is not being called, also if the app is in foreground onMessage is not called either. However if the app is closed it does trigger onLaunch
I wonder how can i fix this? or if anyone else is having this problem?
The problem was that i was using another plugin for handling local notifications(flutter_local_notifications) and it was causing conflict with firebase messaging(the plugin says that in the Readme file), so i removed flutter_local_notifications and firebase messaging started to work as intended
Did you try setting:
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
in ios/Runner/info.plist?
Related
I am using Firebase cloud messaging for flutter. Everything works as expected, when the app is either open or in the background. But if I close the app (terminated) no messages are received.
I send the messages with the firebase console.
I have tried two emulators, that both had play services installed.I even logged in with a google account in the emulator.
Any ideas what I might be doing wrong?
I set priority to high and it started working. The docs only talk about priority high in the context of data messages but it seems it is important for notifications as well then.
I'm using the following plugin for implementing and handling FCM push notifications in my xamarin application and there's one little unaddressed problem I'm facing.
I was hoping someone else has already figured it out and could help me.
THE PROBLEM:
It seems to be duplicating my MainActivity although I have the LaunchMode set to SingleTop.
There's an event called OnNotificationReceived that's provided by the library.
This event fires as expected, only once, when the application is in the foreground.
When I minimize the application (let it run in the background), send a notification to the device and tap on the notification, it opens the application, as expected, but if I send another notification after that, while the application is in the foreground, The OnNotificationReceived Event is fired twice.
I've tried changing the NotificationActivityFlags property to SingleTop.
I've tried changing my MainActivity's Launch Mode to SingleTop
I tried running the sample application they've provided to check if its something that I'm doing wrong, and still the same thing happens.
Logging the issue in their Github repository
None of the above have worked.
The issue can be reproduced by:
downloading the sample from the repository, link provided above
replacing their google-services.json file with your own from the Firebase
console.
change the package name of the sample of the application to the one you
have registered on Firebase
following the steps above that I've mentioned
ADDITIONAL INFO
Version Number of Plugin: 1.3.0
Device Tested On: Huawei P8 Lite Android Version 6.0
Version of VS: Visual Studio 2019
Version of Xamarin: 3.4.0.1009999
Update:
Unfortunately, the method below has not proven successful after attempting to implement it, I should have thought of the fact that I'm still going to need the notification object for iOS, earlier.
Myself and the team are going to implement a way to keep track of the users platform on the server and send them a notification either with or without the notification based on their platform, since iOS handles FCM notifications differently from Android. For now we're going to use Google's Instance ID service to determine what platform existing users are on.
Workaround:
I hope this helps someone in the future, if not I hope someone can provide me with a better solution.
In order to have my cake and eat it, basically be able to keep the notification object in the payload instead of removing it and having to further customise the payload to display notifications just for iOS, I changed the MainActivity's (the activity thats launched when a user taps on the notification) Launch mode to SingleInstance. That way I can keep my notification object in the payload and not have to worry about the OnNotificationReceived event being triggered twice.
I am using the flutter framework with the firebase messaging plugin to enable push notifications. Firebase messaging are working correctly on iOS when compiling my flutter app in debug mode. I haven't tried it on Android yet. But when I am compiling in release mode, no push notification appears. In Firebase, I have not filled in app-name and store-id yet, since the app is not release within the Apple AppStore yet. Might that be the issue?
Also had this issue (firebase_messaging: ^7.0.3), spent few hours fixing it. For me worked two steps:
FIRST
change
<key>FirebaseAppDelegateProxyEnabled</key>
<true/>
to
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
in the ios/Runner/Info.plist file.
More info is here flutter: fcm ios push notifications doesn't work in release mode
SECOND
When init pushes use this code
FirebaseMessaging firebaseMessaging = FirebaseMessaging();
if (Platform.isIOS) {
firebaseMessaging.configure();
userPermission = await firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings());
}
Check whether you added Push Notification capability to all configurations and not only in debug mode:
Open Runner.xcworkspace with Xcode.
Go to Runner in Targets.
Go to “Signing & Capabilities”
Next to “+ Capability” select “All”.
Check that all configurations have “Push Notifications”.
Below my “Signing & Capabilities” screen from Xcode:
I have a react-native app, and I thoroughly followed all the steps mentioned here to add Firebase to your app, and Add the SDK.
However, when I try to send my first notification using the Notification composer, my application simply crashes with the message "pushNotif has stopped working". This happenes regardless of background or foreground state.
Has anyone ever experienced this? does anyone have any idea what could be wrong?
You should try react-native-fcm to implement FCM in react-native, then you'll be able to handle notifications in your react-native javascript code.
At first glance, this may look similar to many other questions on stack overflow, but I didn't find the solution for the issue I am facing. I am using xcode 8.3.2 and ios 10.3.2 and configured FCM to send push notifications. I am receiving push notifications in foreground, background and not running states so no problem from firebase end or certificates. I have set the delegate for UNUserNotificationCenter and FIRMessaging as well. I am testing the service by sending notification from firebase console. When I press the notification to launch the app, the method userNotificationCenter didReceive response method is getting called, but when the app is in foreground userNotificationCenter willPresent notification is not getting called when a notification arrives. I have tried enabling and disabling method swizzling as well. didn't help.