Thursday, September 24, 2026
HomeiOS DevelopmentFlutter: Utilizing FCM, can't obtain notification badge counter on the iOS app...

Flutter: Utilizing FCM, can’t obtain notification badge counter on the iOS app icon on homescreen

[ad_1]

I’m subscribing to a subject and pushing notifications utilizing Firebase console/cloud messaging; On Android, every part works fantastic. On iOS, I obtain notifications within the notification centre whereas the app is in foreground/background/terminated(profile mode), however there isn’t a badge on the app icon.

I’m working on iPhone 12 professional with iOS 15. Have tried on iPhone Xs as properly. Operating on each debug and profile mode, nonetheless not seeing any badge on the app icon.

I’ve additionally tried flutter_app_badger nonetheless not getting any badge depend.

in my essential file;

Future<void> _messageHandler(RemoteMessage message) async {
  print('background message ${message.notification!.physique}');
}

Future<void> essential() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    choices: DefaultFirebaseOptions.currentPlatform,
  ).then((worth) {
    FirebaseMessaging.onBackgroundMessage(_messageHandler);
  });

  runApp(MyApp());
}

Within the initState of my app first display;

@override
  void initState() {
    tremendous.initState();
        PushNotify().init(context);
 

   messaging = FirebaseMessaging.occasion;
    messaging.subscribeToTopic("messaging");
    initialize(context);
    enableForegroundNot();

    FirebaseMessaging.onMessage.hear((RemoteMessage occasion) {

      // FlutterAppBadger.updateBadgeCount(1);

      if (occasion.notification != null) {
        print('Message additionally contained a notification: ${occasion.notification}');
      }
      showDialog(
          context: context,
          builder: (BuildContext context) {
            return CupertinoAlertDialog(
              title: Textual content("Notification"),
              content material: Textual content(occasion.notification!.physique!),
              actions: [
                TextButton(
                  child: Text("Ok"),
                  onPressed: () {
                    Navigator.of(context).pop();
                  },
                )
              ],
            );
          });
    });
    FirebaseMessaging.onMessageOpenedApp.hear((message) {
      print('Message clicked!');
      // FlutterAppBadger.removeBadge();
    });
  }


  Future<void> enableForegroundNot() async {
    await messaging.setForegroundNotificationPresentationOptions(
      alert: true, // Required to show a heads up notification
      badge: true,
      sound: true,
    );
  }

  Future initialize(context) async {
    if (Platform.isIOS) {
      messaging.requestPermission(
        alert: true,
        announcement: false,
        badge: true,
        carPlay: false,
        criticalAlert: false,
        provisional: false,
        sound: true,
      );
    }
  }

I additionally see this in my console

8.11.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Distant Notifications proxy enabled, will swizzle distant notification receiver handlers. In the event you'd favor to manually combine Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Information.plist, and set it to NO. Comply with the directions at:
https://firebase.google.com/docs/cloud-messaging/ios/consumer#method_swizzling_in_firebase_messaging
to make sure correct integration.

Unsure if it has something to do with the badge or not, however could not discover FirebaseAppDelegateProxyEnabled in information.plist of my challenge.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments