Skip to content

[firebase_messaging] onLaunch/onResume not triggered for background notifications on iOS #2284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yazinsai opened this issue Apr 2, 2020 · 11 comments
Labels
impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working

Comments

@yazinsai
Copy link

yazinsai commented Apr 2, 2020

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

@yazinsai yazinsai added the type: bug Something isn't working label Apr 2, 2020
@TahaTesser
Copy link

TahaTesser commented Apr 2, 2020

possible duplicate of #2011

@yazinsai
Copy link
Author

yazinsai commented Apr 2, 2020

@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

@TahaTesser
Copy link

TahaTesser commented Apr 2, 2020

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

@TahaTesser TahaTesser reopened this Apr 2, 2020
@kirstywilliams kirstywilliams added impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) plugin: messaging labels Apr 20, 2020
@tonydiaz
Copy link

tonydiaz commented May 8, 2020

Seeing the same issue as @yazinsai.

@crazedVic
Copy link

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.

@otopba
Copy link

otopba commented May 30, 2020

Same issue ...

@Nico04
Copy link

Nico04 commented Jun 15, 2020

Same issue here, any workaround ?

Flutter v1.17.3
firebase_messaging v6.0.16
iOS 13.5.1

@buimanhhungit
Copy link

Same issue here, any workaround ?

@kalpesh
Copy link

kalpesh commented Jul 13, 2020

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

@TahaTesser TahaTesser added the platform: ios Issues / PRs which are specifically for iOS. label Jul 15, 2020
@mustafa-707
Copy link

Still happening Here , any update ?

@russellwheatley
Copy link
Member

Hey folks, onLaunch & onResume are no longer part of the firebase_messaging API which is 4 major versions removed since this issue was created. I'd advise using v10.0.2 and following the latest documentation for handling messages.

@firebase firebase locked and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

12 participants