Closed anderscheow closed 4 years ago
[✓] Flutter (Channel unknown, v1.12.13+hotfix.7, on Mac OS X 10.15.3 19D76, locale en-GB)
• Flutter version 1.12.13+hotfix.7 at /usr/local/bin/flutter
• Framework revision 9f5ff2306b (6 weeks ago), 2020-01-26 22:38:26 -0800
• Engine revision a67792536c
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/marcin.pawlowski/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = /Users/marcin.pawlowski/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.8.3
[!] Android Studio (version 3.3)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 43.0.3
• Dart plugin version 193.6494.35
@pawlowskim I created a Swift version of the app I've been using for testing here and when I try it out, it works fine. One thing that is different is it doesn't have the following lines
FirebaseApp.configure()
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
@hansiiification Just remembered something, did you turn on the remote notifications capability? See https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app?language=objc
@MaikuB Setup 1:
firebase_messaging: 6.0.9
without
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
Info.plist set to true (I'm not sure if it was added in your fork or not), no flutter_local_notification
.
Firebase messaging working as expected.
Setup 2:
firebase_messaging: 6.0.9
flutter_local_notifications: 1.2.0+4
without
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
Info.plist set to true (I'm not sure if it was added in your fork or not). Firebase messaging working as expected, local notification on click not working.
Setup 3:
firebase_messaging: 6.0.9
flutter_local_notifications: 1.2.0+4
with
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
Info.plist set to true (I'm not sure if it was added in your fork or not). Neither local or firebase messaging "onTap" not working.
UNUserNotificationCenter delegate received call to -userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: but the completion handler was never called.
Setup 4:
firebase_messaging:
git:
url: https://github.com/MaikuB/flutterfire.git
path: packages/firebase_messaging
flutter_local_notifications: 1.2.0+4
with
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
Info.plist set to true (I'm not sure if it was added in your fork or not). Firebase messaging works, local notifications on click not triggers and shows:
UNUserNotificationCenter delegate received call to -userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: but the completion handler was never called.
The last one you say you have the setting in Info.plist set to true but it should be set to false (see https://github.com/MaikuB/flutter_firebase_local_notifications_examples/blob/79576770d505cbeeeacdcc55a3ed84e3892acd2f/kotlin_swift/ios/Runner/Info.plist#L24)
@MaikuB Why in your example local notification is show on top of the app even when app is in foreground? Could it be related why it doesn't works for me?
hey guys, can you take a moment and you consider if you can/should take this on private?
@adrianvintu good call. Note though that you can opt to unsubscribe from the thread here as well though chances are you might've subscribed to see if this gets closed
@pawlowskim @hansiiification and others using my fork of the firebase_messaging
plugin: if you run into issues with the fork you can post on the forked repository https://github.com/MaikuB/flutterfire
Similar to @pawlowskim firebase_messaging
works fine (including background messages, even when app is killed), but local_notifications
do not. Interestingly, it works perfectly (both) in the emulator, however not in production.
Will repeat again that if you're using my fork of the firebase messaging plugin, please post on the repository that has my fork as a separate issue. This thread is getting quite long now and wasn't originally intended to as a way to solve issues with the fork so there are others getting email notifications that aren't relevant to them.
I'll be considering locking this thread should it happen again. Thanks for your understanding
For those affected by this issue, my PR to firebase_messaging
has been merged and released so please update your firebase_messaging
dependency to 6.0.13 and follow the steps in the readme. I will close this issue as I believe this should be resolved now. There is still one problem on the firebase_messaging
side where it removes notifications when the app goes to the foreground. See https://github.com/FirebaseExtended/flutterfire/issues/114#issuecomment-583697109 and https://github.com/FirebaseExtended/flutterfire/issues/762 for info and to subscribe for updates
Thanks @MaikuB , I tested with firebase_messaging: 6.0.13 & flutter_local_notifications: 1.4.0 and now everything has been fixed.
I have tested it with firebase_messaging: 6.0.13 & flutter_local_notifications: 1.4.1 and I only received message in onMessage Mode , Where I'm wrong I put in info.plist
<key>FirebaseAppDelegateProxyEnabled</key> <false/>
and in AppDelegate.swift
//FCM configration if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate }
I have working on flutter dev channel v1.18.
You need to make sure you use a real device and turned on the remote notifications capability https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app
I actually enabled remote notifications and test it on my iPhone 7
You need to make sure you use a real device and turned on the remote notifications capability https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app
it's received form onMessage when app open but other function never trigger when app terminated or background never received
I actually enabled remote notifications and test it on my iPhone 7
You'll need to make sure you've done this for the configuration modes you're using (debug/release/profile) or turn it on for all configurations. Not sure if you've done that
it's received form onMessage when app open but other function never trigger when app terminated or background never received
Now I'm not even sure what your issue is. You mention other functions but there's only onMessage
unless you're referring to onLaunch
and onResume
. Also, you originally mentioned your problem was not getting messages in other scenarios. This is different from what ypou're describing. You probably need to use other forums to get help so that they can look into your app in more depth. Those functions are specific to firebase_messaging
as well. Not sure if you tried it but I'd suggest testing that using firebase_messaging
on its own works in your app first i.e. uninstall flutter_local_notifications
when testing this to isolate the issue
Now I'm not even sure what your issue is. You mention other functions but there's only
onMessage
unless you're referring toonLaunch
andonResume
. Also, you originally mentioned your problem was not getting messages in other scenarios. This is different from what ypou're describing. You probably need to use other forums to get help so that they can look into your app in more depth. Those functions are specific tofirebase_messaging
as well. Not sure if you tried it but I'd suggest testing that usingfirebase_messaging
on its own works in your app first i.e. uninstallflutter_local_notifications
when testing this to isolate the issue
yes you are right , it's my bad , I have unchecked fetch background
, sorry and thank you for your effort.
good work
Ahora ni siquiera estoy seguro de cuál es tu problema. Menciona otras funciones, pero solo hay a
onMessage
menos que se refiera aonLaunch
yonResume
. Además, originalmente mencionaste que tu problema no era recibir mensajes en otros escenarios. Esto es diferente de lo que estás describiendo. Probablemente necesite usar otros foros para obtener ayuda para que puedan examinar su aplicación con más profundidad. Esas funciones son específicas defirebase_messaging
también. No estoy seguro de si lo probó, pero le sugiero probar que usarlofirebase_messaging
por sí solo funciona primero en su aplicación, es decir, desinstalarloflutter_local_notifications
al probar esto para aislar el problemaSí, tienes razón, es mi mal, he desmarcado
fetch background
, lo siento y gracias por tu esfuerzo. buen trabajo
I have the same error. Notifications come in only onMessage, onResume and onLaunch don't work. How did you solve this error? Thank you.
Ahora ni siquiera estoy seguro de cuál es tu problema. Menciona otras funciones, pero solo hay a
onMessage
menos que se refiera aonLaunch
yonResume
. Además, originalmente mencionaste que tu problema no era recibir mensajes en otros escenarios. Esto es diferente de lo que estás describiendo. Probablemente necesite usar otros foros para obtener ayuda para que puedan examinar su aplicación con más profundidad. Esas funciones son específicas defirebase_messaging
también. No estoy seguro de si lo probó, pero le sugiero probar que usarlofirebase_messaging
por sí solo funciona primero en su aplicación, es decir, desinstalarloflutter_local_notifications
al probar esto para aislar el problemaSí, tienes razón, es mi mal, he desmarcado
fetch background
, lo siento y gracias por tu esfuerzo. buen trabajoI have the same error. Notifications come in only onMessage, onResume and onLaunch don't work. How did you solve this error? Thank you.
be sure you are on last version of local_notification
and firebase_messaging
and open Xcode and be sure also you are checked enabled fetch background
& push notification
Thanks @MaikuB , I tested with firebase_messaging: 6.0.13 & flutter_local_notifications: 1.4.0 and now everything has been fixed.
@duytq94 can you share the pubspec.lock file? I installed local_notification 1.4.0 (version 1.4.1 already exists) and firebase_messaging 6.0.13 (latest). In Xcode configure Capabilities Notifications and checked Background fetch and Remote notifications inside Background Modes. Notifications on Android work. Foreground Notifications on iOS work. Background Notifications in iOS do NOT work.
if the app is in the background and a notification arrives it is not displayed. When the application reopens just there the notification is displayed.
@gpibarra Are you using the iOS simulator as you need to test on a real device
Real device [✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale es-419) • Flutter version 1.12.13+hotfix.9 at /Users/defe/develop/flutter • Framework revision f139b11009 (4 weeks ago), 2020-03-30 13:57:30 -0700 • Engine revision af51afceb8 • Dart version 2.7.2
[✓] Xcode - develop for iOS and macOS (Xcode 11.4) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.4, Build version 11E146 • CocoaPods version 1.9.1
[✓] Connected device (1 available) • .... • .............. • ios • iOS 13.4
There might be something else going on there that isn't to do with this plugin that you'll need someone to help go in-depth
@gpibarra resolved? let me know background notification works if do like this
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
)
-> Bool {
GeneratedPluginRegistrant.register(with: self)
// if #available(iOS 10.0, *) {
// UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
// }
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
It seems to work. I did was first call "_flutterLocalNotificationsPlugin.initialize" before the "_firebaseMessaging.requestNotificationPermissions"
I'm using both plugins (firebase_messaging: ^ 6.0.13 and flutter_local_notifications: ^ 1.4.3), firebase push notifications work fine on both platforms, while local notifications don't work for me on physical devices, it only works on simulator
@1996SEJR there's extra configuration that needs to be done for both plugins to work together. Have you done that?
Something is still not right with this package. Looking at willPresentNotification:
I can see that only firebase checks if the message was sent through itself. This plugin does not, and will interfere with firebase and other push services.
Why? Flutter simply executes this method for every plugin that implements it: https://github.com/flutter/engine/blob/master/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm#L288-L294
So completionHandler may be executed multiple times, and AFAIK in this situation only the first time does anything (thankfully it does not crash).
@szotp thanks for picking up the gap there. Fix on that will land soon
1.4.4 is out with the fix now
I am not getting notification when the IOS app is terminated. Android app is working fine I am using fire base messaging service @MaikuB
@mizzb not an issue with this plugin and it's something you'll need to investigate within your app
Method on Firebase Cloud Messaging, onMessage and onResume do not get trigger when I include flutter_local_notifications package.