Comments (18)
This seems like a pretty highly requested feature. I'm currently also struggling because of this missing feature. Do we have an estimation on when we can expect this?
Also is there anyone that has been able to get around this? So handling silent notifications when app is in background or terminated on iOS.
from flutterfire.
Using Notification Service Extension is one way to do it, yes.
Flutter is excellent framework that allows to build and ship beautiful UI in bizarre speed. However does this mean it provides everything we want (from our perspective)? No. Does this mean we have drop Flutter and use SwiftUI (buggy) or storyboards? No.
We made decision to use Flutter for UI and we are handling pretty much all business logic there except when it comes to push notifications and some other minor features as well - this is what you are better of rolling your own.
Implementing Notification Service Extension and making it work with Flutter is matter of a few hours and considering how many fail to do so is somewhat amusing but not shocking considering the entry level.
We did use Notification Service Extension with Notification Content Extension for fancier notifications for some months but at the end we dropped it and moved to PushKit (w/ CallKit obviously) and rolled our own notification presenter logic which resulted us dropping both Notification Service and Content Extension.
My advice for those who need to add push notifications support for Flutter - solve it on native side, you will thank yourself later.
from flutterfire.
How about using the NotificationServiceExtension (native code) with firebase_messaging?
I did it and it is working well!
from flutterfire.
How about using the NotificationServiceExtension (native code) with firebase_messaging?
I did it and it is working well!
Could you explain how to do that? can You give us a snipplets o something else?
Can you give us an example of
2 - On XCode, create the NotificationServiceExtension to do the background work
from flutterfire.
How about using the NotificationServiceExtension (native code) with firebase_messaging?
from flutterfire.
How about using the NotificationServiceExtension (native code) with firebase_messaging?
I did it and it is working well!
Mind providing a gist on how you solved it? :)
from flutterfire.
How about using the NotificationServiceExtension (native code) with firebase_messaging?
I did it and it is working well!
Mind providing a gist on how you solved it? :)
Just follow the steps bellow:
1 - Follow this tutorial to configure firebase_messaging Push notification with firebase cloud messaging(FCM)
2 - On XCode, create the NotificationServiceExtension to do the background work
3 - Use something like Postman or Curl to do a request like that:
curl --location --request POST 'https://fcm.googleapis.com/fcm/send'
--header 'Content-Type: application/json'
--header 'Authorization: key=<server_key>'
--data-raw '{
"to": "<your_FCM_device_token>",
"notification": {
"title": "My title",
"body": "That's the body",
"mutable_content": true
},
"data": {
"magicValue": "It is really a magic value?"
}
}'
from flutterfire.
How about using the NotificationServiceExtension (native code) with firebase_messaging?
I did it and it is working well!
Mind providing a gist on how you solved it? :)
Just follow the steps bellow:
1 - Follow this tutorial to configure firebase_messaging Push notification with firebase cloud messaging(FCM)
2 - On XCode, create the NotificationServiceExtension to do the background work
3 - Use something like Postman or Curl to do a request like that:
curl --location --request POST 'https://fcm.googleapis.com/fcm/send'
--header 'Content-Type: application/json'
--header 'Authorization: key=<server_key>'
--data-raw '{
"to": "<your_FCM_device_token>",
"notification": {
"title": "My title",
"body": "That's the body",
"mutable_content": true
},
"data": {
"magicValue": "It is really a magic value?"
}
}'
I want to implement a background execution to save some notification information on my local DB. Notification Service Extension is the way to go? Now I'm trying to override "didReceiveRemoteNotification" on my AppDelegate class (inherited from FlutterAppDelegate) without sucess.
I did this:
` override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
let notificationChannel = FlutterMethodChannel(name: "br.uff.uffmobileplus/notification_channel", binaryMessenger: controller as! FlutterBinaryMessenger)
notificationChannel.invokeMethod("saveToDataBase", arguments: userInfo)
completionHandler(UIBackgroundFetchResult.newData)
}`
But it's not working since the previous override (didFinishLaunchingWithOptions) is the only one that runs and the didReceiveRemoteNotification is not called when the app receives a push notification on background.
from flutterfire.
How about using the NotificationServiceExtension (native code) with firebase_messaging?
I did it and it is working well!
Mind providing a gist on how you solved it? :)
Just follow the steps bellow:
1 - Follow this tutorial to configure firebase_messaging Push notification with firebase cloud messaging(FCM)
2 - On XCode, create the NotificationServiceExtension to do the background work
3 - Use something like Postman or Curl to do a request like that:curl --location --request POST 'https://fcm.googleapis.com/fcm/send'
--header 'Content-Type: application/json'
--header 'Authorization: key=<server_key>'
--data-raw '{
"to": "<your_FCM_device_token>",
"notification": {
"title": "My title",
"body": "That's the body",
"mutable_content": true
},
"data": {
"magicValue": "It is really a magic value?"
}
}'I want to implement a background execution to save some notification information on my local DB. Notification Service Extension is the way to go? Now I'm trying to override "didReceiveRemoteNotification" on my AppDelegate class (inherited from FlutterAppDelegate) without sucess.
I did this:`
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
let notificationChannel = FlutterMethodChannel(name: "br.uff.uffmobileplus/notification_channel", binaryMessenger: controller as! FlutterBinaryMessenger)notificationChannel.invokeMethod("saveToDataBase", arguments: userInfo) completionHandler(UIBackgroundFetchResult.newData) }
`
But it's not working since the previous override (didFinishLaunchingWithOptions) is the only one that runs and the didReceiveRemoteNotification is not called when the app receives a push notification on background.
You need to follow the steps I said. Use NotificationServiceExtension. If you need to communicate with your flutter app, use platform channels.
from flutterfire.
How about using the NotificationServiceExtension (native code) with firebase_messaging?
I did it and it is working well!
Mind providing a gist on how you solved it? :)
Just follow the steps bellow:
1 - Follow this tutorial to configure firebase_messaging Push notification with firebase cloud messaging(FCM)
2 - On XCode, create the NotificationServiceExtension to do the background work
3 - Use something like Postman or Curl to do a request like that:curl --location --request POST 'https://fcm.googleapis.com/fcm/send'
--header 'Content-Type: application/json'
--header 'Authorization: key=<server_key>'
--data-raw '{
"to": "<your_FCM_device_token>",
"notification": {
"title": "My title",
"body": "That's the body",
"mutable_content": true
},
"data": {
"magicValue": "It is really a magic value?"
}
}'I want to implement a background execution to save some notification information on my local DB. Notification Service Extension is the way to go? Now I'm trying to override "didReceiveRemoteNotification" on my AppDelegate class (inherited from FlutterAppDelegate) without sucess.
I did this:
`
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
let notificationChannel = FlutterMethodChannel(name: "br.uff.uffmobileplus/notification_channel", binaryMessenger: controller as! FlutterBinaryMessenger)notificationChannel.invokeMethod("saveToDataBase", arguments: userInfo) completionHandler(UIBackgroundFetchResult.newData) }
`
But it's not working since the previous override (didFinishLaunchingWithOptions) is the only one that runs and the didReceiveRemoteNotification is not called when the app receives a push notification on background.You need to follow the steps I said. Use NotificationServiceExtension. If you need to communicate with your flutter app, use platform channels.
I tried but I couldn't use the channel created on AppDelegate inside the NotificationServiceExtension target, and to create a channel I need a controller that needs the window from UIAplication. At least that's what I've found.
from flutterfire.
FYI for anyone ending up here when trying to setup silent data notifications (a.k.a. content-available).
The workarounds mentioned in this thread are not required for those kinds of notifications. If all you want is for your app to be able to receive key/value data and update some remote data in the background, you will be ok following something like this SO question:
Firebase FCM silent push notifications for iOS
Correct me if I am wrong...
This is a discussion about receiving notifications that go outside of that "normal" iOS notification concept. Correct? E.g.
- you need long-running background processing
- you want to get notifications even though the app was killed (which stops background notifications on purpose in iOS)
from flutterfire.
FYI for anyone ending up here when trying to setup silent data notifications (a.k.a. content-available).
The workarounds mentioned in this thread are not required for those kinds of notifications. If all you want is for your app to be able to receive key/value data and update some remote data in the background, you will be ok following something like this SO question:
Firebase FCM silent push notifications for iOSCorrect me if I am wrong...
This is a discussion about receiving notifications that go outside of that "normal" iOS notification concept. Correct? E.g.
- you need long-running background processing
- you want to get notifications even though the app was killed (which stops background notifications on purpose in iOS)
Yes I'm trying to set up a background execution when a data notification arrives. Using the silent notification I was able to execute when app on foreground or background but not when app was killed( which is the expected behavior from what I saw) then how can I handle for all the 3 cases?
from flutterfire.
If all you want is for your app to be able to receive key/value data and update some remote data in the background, you will be ok following something like this SO question:
Firebase FCM silent push notifications for iOS
@eimermusic are you saying that the plugin currently supports receiving and processing silent pushes in the background on iOS? I have not been able to do that with the onBackgroundMessage
callback.
from flutterfire.
In the meantime. I've found that work is being done to address this in this PR #2016 However I've not been able to get that one to work for me.
from flutterfire.
I have been able to get PR #2016 to work for me. Apparently it's hit and miss. Worth a shot if this issues means a dead end for the plugin for you.
from flutterfire.
This seems like a pretty highly requested feature. I'm currently also struggling because of this missing feature. Do we have an estimation on when we can expect this?
Also is there anyone that has been able to get around this? So handling silent notifications when app is in background or terminated on iOS.
Did you succeed in this? I'm also trying hard to get silent content-available only push to reach my ios app and get some execution time while the app is in the background or terminated state.
Anything I can do here? @michaelgobbers
from flutterfire.
Hello,
Im new with flutter and I was trying to setup background notifications for IOS ? for me it only works on Android. is this not supported ? if so, are there plans to make this available ?
Unhandled Exception: MissingPluginException(No implementation found for method FcmDartService#start on channel plugins.flutter.io/firebase_messaging)
from flutterfire.
Hey all, this is now supported in the current dev release, along with macOS platform support landing as well (See the migration guide doc for a full changelog and how to upgrade).
For discussions/feedback around trying out this dev release please see #4023 - would love feedback.
from flutterfire.
Related Issues (20)
- [Firebase_Database]: <Error: Exception: Unknown event type: DatabaseEventType.value> HOT 3
- [firebase_analytics]: Crashlytics doesn't track screen view breadcrumbs HOT 9
- [cloud_firestore]: iOS includeMetadataChanges on document snapshots does not receive fromCache events correctly HOT 1
- [📚] Your documentation feedback title (CHANGE ME)
- [firebase_auth]: Can't use verifyPhoneNumber before updating the phone number? HOT 2
- 🐛 [flutter_facebook_auth] Automatically verify email addresses with Facebook sign-in HOT 2
- [firebase_analytics]: Firebase Analytics 10.10.5 and 10.10.4 version cannot build Android HOT 7
- [firebase_auth]: error.credential is null on credential-already-in-use exception during apple sign in in web HOT 3
- [firebase_auth]: [firebase_auth/app-not-authorized] This app is not authorized to use Firebase Authentication. Please verify that the correct package name, SHA-1, and SHA-256 are configured in the Firebase Console. [ Invalid app info in play_integrity_token ] HOT 5
- [📚] Your documentation feedback title (CHANGE ME)
- [flutterfire_cli]: v1.0.0 update command fails on Windows HOT 1
- [ALL] Consider adding `topics` to `pubspec.yaml` for better discoverability HOT 1
- [FIRESTORE]: includeMetadataChanges does not make the stream emit second non cache event HOT 1
- [firebase_crashlytics] 此应用有 1 个崩溃问题未处理。请上传 1 个 dSYM 文件以处理崩溃问题。 HOT 1
- [firebase_analytics]: What is the higher minimum MacOS deployment version for the last version HOT 1
- [firebase_analytics]: <firebase_analytics does not work in Android, after migrating build.gradle > HOT 2
- [firebase_analytics]: logPurchase crashes when any of the values inside parameters is null HOT 2
- [FIIREBASE_AUTH] Unable to establish connection on channel. HOT 2
- [📚] [firebase_messaging_web] How to load on Flutter 3.22?
- [firebase_app_check]: The new Firebase App Check token is not being updated in Firestore and other services that have App Check enforced.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutterfire.