firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.67k stars 3.96k forks source link

Firebase Cloud Messaging never receive both ios and android #7628

Closed alexaung closed 2 years ago

alexaung commented 2 years ago

Bug report

I have configured as per this link https://firebase.flutter.dev/docs/messaging/overview. May I know which step I need to do.

Steps to reproduce

  1. Configure the Firebase Cloud Messaging
  2. flutter build apk --release && flutter install
  3. Send Notification from Google Firebase console.

Expected behavior

I should see the notification on Android and iOS notification bar.

Flutter doctor

[✓] Flutter (Channel stable, 2.8.0, on macOS 12.0.1 21A559 darwin-x64, locale en-GB) • Flutter version 2.8.0 at /Users/aungmyooo/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision cf44000065 (8 days ago), 2021-12-08 14:06:50 -0800 • Engine revision 40a99c5951 • Dart version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/aungmyooo/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

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

[✓] Connected device (3 available) • SM N975F (mobile) • RF8M82Y3K9A • android-arm64 • Android 11 (API 30) • Aung Myo’s iPhone (mobile) • 06e02964e429eeebf29550b03ef955abe09891ef • ios • iOS 15.1 19B74 • Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.110

• No issues found!



### Flutter dependencies

  firebase_core: ^1.10.5
  firebase_analytics: ^9.0.3
  firebase_crashlytics: ^2.4.3
  firebase_messaging: ^11.2.3
darshankawar commented 2 years ago

@alexaung There could be many factors as why you are not receiving notifications. First step is to check if you have properly configured your setup as mentioned in the document. Check by sending a notification directly to FCM token. For iOS, check your setup is correct: https://firebase.flutter.dev/docs/messaging/apple-integration Check if you have requested notifications permissions on the device you are testing. Is the notification sent successfully if you send it directly to the FCM token? Check if the package identifier is the same as in the apple configuration. For iOS, check your APNs certificate from Firebase, Cloud Messaging, iOS is current or expired. You can try to re-generate the certificate and see if it helps along with your debug certificate key.

alexaung commented 2 years ago

Thanks for reply. I need to add requestPermission in iOS and now it is working.