Flutterfire: [firebase_messaging] onLaunch/onResume not triggered for background notifications on iOS

Created on 2 Apr 2020  Â·  10Comments  Â·  Source: FirebaseExtended/flutterfire

Describe the bug
Background notifications on iOS do not trigger the onLaunch / onResume methods in my Flutter app. I also do not see a badge / notification in the iOS notification center. Instead, I receive an onMessage trigger when the app is reopened

To Reproduce
I created a minimal repo that exhibits this behavior

  1. Clone the repository here
  2. Run the app on the iOS simulator
  3. Note the Token: xxx value in the Debug Console
  4. Move the app to the background
  5. Trigger a notification using the following curl command:
DATA='{"notification": {"body": "this is a body","title": "this is a title"}, "priority": "high", "data": {"click_action": "FLUTTER_NOTIFICATION_CLICK", "id": "1", "status": "done"}, "to": "<TOKEN>"}'
curl https://fcm.googleapis.com/fcm/send -H "Content-Type:application/json" -X POST -d "$DATA" -H "Authorization: key=AAAALOSN_jE:APA91bEl5CscNyXpHRrz9F4lJJnFTlt9_FPwEOvI54Q6dr2eSuS00rryGiEXkABdhfMSHimkHrybSh7r3kfhVlciBpO3HYPa_kyT34eg-JE3bWsUg479OQK5ANzCTpJ-bvktN1AWw9j4"

Expected behavior
I expect a notification to appear in the iOS Notification Center, that when clicked will trigger the onResume method. Instead, no notification is presented.

Additional context
Output of flutter doctor -v:

[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.3 19D76, locale en-BH)
    • Flutter version 1.12.13+hotfix.9 at /Users/rock/Downloads/flutter
    • Framework revision f139b11009 (2 days ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/rock/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.43.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.8.1

[✓] Connected device (1 available)
    • iPhone 11 • 11E9FF08-2E40-4812-A0A4-DC3B1E3398CC • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

• No issues found!

Note: I could not find the solution in #935 #1757 #1677 or #2011

customer ios messaging bug

Most helpful comment

Same issue here, any workaround ?

Flutter v1.17.3
firebase_messaging v6.0.16
iOS 13.5.1

All 10 comments

possible duplicate of #2011

@TahaTesser I included a link to a minimal repo that demonstrates this issue. The solutions proposed in #2011 do not provide a fix that resolves this issue

@yazinsai
Reopened the issue as possible duplicate and for proposed solutions aren't working from the mentioned issues.
Thank you

Seeing the same issue as @yazinsai.

I am seeing the same thing as well, but only on ios 13.1 and up. Exact same project works as expected in 12.4.

Same issue ...

Same issue here, any workaround ?

Flutter v1.17.3
firebase_messaging v6.0.16
iOS 13.5.1

Same issue here, any workaround ?

I am also facing the same issue, any fix or workaround?

Still happening Here , any update ?

Was this page helpful?
0 / 5 - 0 ratings