简体   繁体   中英

Flutter / Firebase Messaging. : Not pushing notification when I run my App on release mode

I am computer programming student and who is making mobile app with flutter.

I am having some issue on notification, when I run my app on Debug mode, everything is working fine.

However when I run my app on the release mode with " flutter run --release " this command,

My app is not getting notification. I am pushing the notification with Firebase messagings package.

What I find in another programmer`s code was adding application.registerForRemoteNotifications() code on my AppDelegate.swift, but actually there Is no difference...

How can I fix this problem ?

import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    application.registerForRemoteNotifications() 
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

In summary, on debug mode everything is working fine, however on the release mode , its not getting the notification.

Thanks for reading.

This is a common issue amongst all flutter developers since most of us use VS Code or other light-weight IDEs to develop rather than using android studio. The easy and straight forward way of signing your application is as said in the Google Developers Website .

Just head to your IDE terminal and type cd android and then type ./gradlew signingReport ensure that your "google-services.json" file does include your unique SHA1 Key, which you can get by heading to your C->Program Files->Java->javaversion->bin then run your terminal in this directory and write the command

keytool -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore" 

for windows. this shall show your SHA1 key, head towards google firebase console and sign your projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM