I have flutter app and I use push notification in it
When I receive new notification I remove all notification and badge but sometimes notification badge not remove when open app and it keep increasing
Here is solution I found to remove badge:-
Ios->appDelegete.swift
import UIKit
import Flutter
import Firebase
import UserNotifications
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
if #available(iOS 10.0, *) {
application.applicationIconBadgeNumber = 0 // For Clear Badge Counts
let center = UNUserNotificationCenter.current()
center.removeAllDeliveredNotifications()
center.removeAllPendingNotificationRequests()
center.delegate = self as? UNUserNotificationCenterDelegate
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
But it don't remove my badge is there any way to remove notification badge?