Closed Tzanou123 closed 2 years ago
I do have the same problem, it's working fine but after some time it does not work, after restarting the device it work for about 1 hour.
8. See error or incorrect behavior
What error does it throw ? Can you provide the log ?
Also ,Where have you defined the _firebaseMessagingBackgroundHandler
? - can you show me the content of the whole dart file where you've defined it ? You need to define it outside any classes as a top-level/global function.
Can you also confirm APNs has been setup correctly in your project, iOS/macOS will not work at all without APNs - it must be configured.
Also can you show me how you've setup the onMessage
code in your Dart code?
To be more precise i all the time receive the notification without problem ! But all the trigger come from your dependency doesnt handle the notification received ! But if i restart completly my iPhone XR with ios 15.3.1 the notification are triggered correctly for a short time and then bugs back.
You ask me for the logs but unfortunatly there is no log when the phone doesnt trigger the push notification.
It may help you to understand my bug, if i click on the push notification to open the app i get Received an invalid notification content
.
See below for the _firebaseMessagingBackgroundHandler an onMessage code
_firebaseMessagingBackgroundHandler :
onMessage :
@Tzanou123
Since I see that you are using awesome_notifications
plugin which is third party, it could be an conflict using it and firebase_messaging.
As you mentioned you are getting Received an invalid notification content.
, I am certain that you are hitting same issue as https://github.com/firebase/flutterfire/issues/7249. You can check this issue comment and see if it is applicable for you and resolves issue at your end.
@darshankawar
For testing if the problem come from awesome_notification i trying to uninstall it !
That fixing the error message Received an invalid notification content
but not the trigger problem with onMessage and onBackgroundMessageHandler.
I try on iPhone Se and its worked fine it seems to be related to iphone XR
@Tzanou123 Thanks for the investigation and further updates. I also tried the same on iPhone 6s on which I don't get the behavior you reported. Seems it is specific to device which is a bit weird. Does the XR device have any notification settings that you see is unusual or maybe prohibiting receiving notifications ?
Hey @Tzanou123. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
I have the same issue in my iPhone 7 PLUS
I was trying to reset the iphone config ! And the bug was solved ! I dont know wich config does this bug but we may need to understand whats happen here About my iphone it was just a new one ! i dont really change the config except the locking screen time to never ! @arthas1888 do you have also this config to never ?
All the config for notification was unchanged and green lighted for receiving notification
Glad to know the issue is resolved. As stated earlier, it could have been a snag from the server to send data properly. Closing this as solved. If you see similar issue again, write in comments and I"ll reopen it.
My phone has the default configuration, however background messages only appear as notification but I can't see the _firebaseMessagingBackgroundHandler method being fired IOS 15 iPhone 7 PLUS the code is the same than this repository https://github.com/firebase/flutterfire/tree/master/packages/firebase_messaging/firebase_messaging/example and follow this guide https://firebase.flutter.dev/docs/messaging/apple-integration one month ago the application was working quite well, I thought my app is wrong for that reason I started a new project with this repo but the problem keeps on, I am stuck really I need some help even I can share the whole code
these are the dependencies
`
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
firebase_messaging: ^11.2.13
flutter_local_notifications: ^9.4.0
http: ^0.13.4
`
Bug report
I setup a push notification system in my flutter app all work great with android ! But in iphone the onMessage.listen and onBackgroundMessage functions seems to not be triggered i sent the push notification via a nodejs server : with those below parameter :
if i restart my device it seems to work for a few minutes and then it is'nt i did receive the regular push notification well but the onMessage.listen and onBackgroundMessage functions dont triggered anymore ! Bug appear in foreground and background too
No error come from nodejs server and also from the flutter application log
Error is the same in debug or prod build mode
i was try a lot of fix given by others issues of this github like add some piece of code in the appDelegate.swift but no one seems to work.
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
onMessage.listen and onBackgroundMessage functions triggered at any time.
Additional context
Flutter doctor
Click To Expand
``` [✓] Flutter (Channel stable, 2.10.2, on macOS 12.0.1 21A559 darwin-arm, locale fr-FR) [!] Android toolchain - develop for Android devices (Android SDK version 32.0.0) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] VS Code (version 1.63.0) [✓] Connected device (2 available) [✓] HTTP Host Availability ! Doctor found issues in 1 category. ```Flutter dependencies
Click To Expand
``` Dart SDK 2.16.1 Flutter SDK 2.10.2 reunion 1.0.0+1 dependencies: - awesome_notifications 0.6.21 [flutter platform intl] - badges 2.0.2 [flutter] - base32 2.1.1 - biometric_storage 4.0.1 [flutter flutter_web_plugins logging plugin_platform_interface ffi win32] - change_app_package_name 1.0.0 - crypto 3.0.1 [collection typed_data] - cupertino_icons 1.0.4 - date_format 2.0.5 - device_info_plus 3.2.1 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows] - encrypt 5.0.1 [args asn1lib clock collection crypto pointycastle] - firebase_core 1.12.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_messaging 11.2.6 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine] - flutter_colorpicker 1.0.3 [flutter] - flutter_link_previewer 2.6.3 [flutter flutter_chat_types flutter_linkify html http linkify meta url_launcher] - flutter_local_notifications 9.3.2 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path typed_data vector_math] - flutter_native_splash 2.0.2 [args image meta path xml yaml universal_io flutter] - flutter_spinkit 5.1.0 [flutter] - http 0.13.4 [async http_parser meta path] - local_auth 1.1.11 [flutter flutter_plugin_android_lifecycle intl platform] - localization 2.1.0 [flutter] - material_design_icons_flutter 5.0.6595 [flutter] - otp 3.0.2 [base32 crypto logging] - overlay_support 1.2.1 [flutter async] - pointycastle 3.5.0 [collection convert js] - qr_code_scanner 0.6.1 [js flutter flutter_web_plugins] - sqflite 2.0.2 [flutter sqflite_common path] - url_launcher 6.0.20 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] dev dependencies: - flutter_launcher_icons 0.9.2 [args image path yaml] - flutter_lints 1.0.4 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph typed_data] - integration_test 0.0.0 [flutter flutter_driver flutter_test path vm_service archive async boolean_selector characters charcode clock collection crypto fake_async file matcher material_color_utilities meta source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math webdriver] - test 1.19.5 [analyzer async boolean_selector collection coverage http_multi_server io js node_preamble package_config path pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core] transitive dependencies: - _fe_analyzer_shared 31.0.0 [meta] - analyzer 2.8.0 [_fe_analyzer_shared cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 3.1.6 [crypto path] - args 2.3.0 - asn1lib 1.1.0 - async 2.8.2 [collection meta] - boolean_selector 2.1.0 [source_span string_scanner] - characters 1.2.0 - charcode 1.3.1 - cli_util 0.3.5 [meta path] - clock 1.1.0 - collection 1.15.0 - convert 3.0.1 [typed_data] - coverage 1.0.3 [args logging package_config path source_maps stack_trace vm_service] - csslib 0.17.1 [source_span] - dbus 0.7.1 [args ffi meta xml] - device_info_plus_linux 2.1.1 [device_info_plus_platform_interface file flutter meta] - device_info_plus_macos 2.2.2 [device_info_plus_platform_interface flutter] - device_info_plus_platform_interface 2.3.0+1 [flutter meta plugin_platform_interface] - device_info_plus_web 2.1.0 [device_info_plus_platform_interface flutter_web_plugins flutter] - device_info_plus_windows 2.1.1 [device_info_plus_platform_interface ffi flutter win32] - equatable 2.0.3 [collection meta] - fake_async 1.2.0 [clock collection] - ffi 1.1.2 - file 6.1.2 [meta path] - firebase_core_platform_interface 4.2.4 [collection flutter meta plugin_platform_interface] - firebase_core_web 1.5.4 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_messaging_platform_interface 3.1.6 [firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 2.2.7 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - flutter_chat_types 3.3.1 [equatable json_annotation meta] - flutter_driver 0.0.0 [file flutter flutter_test fuchsia_remote_debug_protocol path meta vm_service webdriver archive async boolean_selector characters charcode clock collection crypto matcher material_color_utilities platform process source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math] - flutter_linkify 5.0.2 [flutter linkify] - flutter_local_notifications_linux 0.4.2 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories] - flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface] - flutter_plugin_android_lifecycle 2.0.5 [flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math] - frontend_server_client 2.1.2 [async path] - fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform] - glob 2.0.2 [async collection file path string_scanner] - html 0.15.0 [csslib source_span] - http_multi_server 3.2.0 [async] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - image 3.1.1 [archive meta xml] - intl 0.17.0 [clock path] - io 1.0.3 [meta path string_scanner] - js 0.6.3 - json_annotation 4.4.0 [meta] - linkify 4.1.0 - lints 1.0.1 - logging 1.0.2 - matcher 0.12.11 [stack_trace] - material_color_utilities 0.1.3 - meta 1.7.0 - mime 1.0.1 - node_preamble 2.0.1 - package_config 2.0.2 [path] - path 1.8.0 - petitparser 4.4.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.2 [meta] - pool 1.5.0 [async stack_trace] - process 4.2.4 [file path platform] - pub_semver 2.1.1 [collection meta] - shelf 1.2.0 [async collection http_parser path stack_trace stream_channel] - shelf_packages_handler 3.0.0 [path shelf shelf_static] - shelf_static 1.1.0 [convert http_parser mime path shelf] - shelf_web_socket 1.0.1 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_map_stack_trace 2.1.0 [path stack_trace source_maps] - source_maps 0.10.10 [source_span] - source_span 1.8.1 [collection path term_glyph] - sqflite_common 2.2.0 [synchronized path meta] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - string_scanner 1.1.0 [charcode source_span] - sync_http 0.3.0 - synchronized 3.0.0 - term_glyph 1.2.0 - test_api 0.4.8 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - test_core 0.4.9 [analyzer async args boolean_selector collection coverage frontend_server_client glob io meta package_config path pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api] - timezone 0.8.0 [path] - typed_data 1.3.0 [collection] - universal_io 2.0.4 [collection crypto meta typed_data] - url_launcher_android 6.0.15 [flutter url_launcher_platform_interface] - url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.0 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface] - url_launcher_web 2.0.9 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.0 [flutter url_launcher_platform_interface] - vector_math 2.1.1 - vm_service 7.5.0 - watcher 1.0.1 [async path] - web_socket_channel 2.1.0 [async crypto stream_channel] - webdriver 3.0.0 [archive matcher path stack_trace sync_http] - webkit_inspection_protocol 1.0.0 [logging] - win32 2.3.10 [ffi] - xdg_directories 0.2.0+1 [meta path process] - xml 5.3.1 [collection meta petitparser] - yaml 3.1.0 [collection source_span string_scanner] ```