实现应用角标管理,提升消息触达效率(iOS/Android 平台差异化封装)
| Files | Last commit | Last update |
|---|---|---|
| 8 months ago | ||
| 9 months ago | ||
| 8 months ago | ||
| 2 years ago | ||
| 3 years ago | ||
| 4 years ago | ||
| 9 months ago | ||
| 6 years ago | ||
| 4 years ago | ||
| 3 years ago | ||
| 9 months ago | ||
| 5 months ago | ||
| 5 months ago | ||
| 9 months ago | ||
| 6 months ago | ||
| 8 years ago | ||
| 8 years ago | ||
| 9 months ago |
Flutter App Badger plugin (UNMAINTAINED)
This plugin for Flutter adds the ability to change the badge of the app in the launcher. It supports iOS, macOS, Ohos, and some Android devices (the official API does not support the feature, even on Oreo).
Getting Started
iOS
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>
macOS
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>
Android
On Android, no official API exists to show a badge in the launcher. But some devices (Samsung, HTC...) support the feature. Thanks to the Shortcut Badger library, ~ 16 launchers are supported.
Ohos
On Ohos, badges depend on system notifications; the plugin will prompt to enable them when setting or removing badges, with no extra permissions or configuration needed.
Dart
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();