简体   繁体   中英

Flutter Firebase Cloud Messaging doesn't show badge number on Ios

I think ios should to manage badge numbers automatic after get notifications. But it doesent't work for me and i can't find the solution. I request the permisson for badge too and i already get it, i see it on my settings. I use firebase cloud notification library only with notification tags. What could be the problem?

i tried to use:

"apns": {
   "payload": {
     "aps": {
       "badge": 5
     }
   }
 }

But doesen't work for me. If is it possible, i would like to manage it automatically.

Cloud messaging: firebase_messaging: 6.0.16

App delegate swift:

import UIKit
import Flutter
import Firebase
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("key")
    GeneratedPluginRegistrant.register(with: self)
    if #available(iOS 10.0, *) {
      UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
        
    }
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support

The value of the badge on the home screen app icon. If not specified, the badge is not changed. If set to 0, the badge is removed.

I don't think that changing badge number automatically is possible for ios

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