- Notifications
You must be signed in to change notification settings - Fork0
Support to update the app badge on the launcher (both for Android and iOS)
License
folksable/flutter_app_badger
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This plugin forFlutter adds the ability to change the badge of the app in the launcher.It supports iOS, macOS, and some Android devices (the official API does not support the feature, even on Oreo).
On iOS, the notification permission is required to update the badge.It is automatically asked when the badge is added or removed.
Please also add the following to your /ios/Runner/Info.plist:
<key>UIBackgroundModes</key> <array> <string>remote-notification</string> </array>
On macOS, the notification permission is required to update the badge.It is automatically asked when the badge is added or removed.
Please also add the following to your /macos/Runner/Info.plist:
<key>NSUserNotificationAlertStyle</key><string>banner</string>
On Android, no official API exists to show a badge in the launcher. But some devices (Samsung, HTC...) support the feature.Thanks to theShortcut Badger library, ~ 16 launchers are supported.
First, you just have to import the package in your dart files with:
import'package:flutter_app_badger/flutter_app_badger.dart';
Then you can add a badge:
FlutterAppBadger.updateBadgeCount(1);
Remove a badge:
FlutterAppBadger.removeBadge();
Or just check if the device supports this feature with:
FlutterAppBadger.isAppBadgeSupported();