g123k/flutter_app_badger
Android 및 iOS 모두에서 런처의 앱 배지 업데이트 지원
- Stars
- 308
- Forks
- 258
- 최근 푸시(UTC)
- 2024. 7. 11.
- 프로젝트 상태
- 보관됨
기술 주제
사용 중인 의존성
의존성 목록 1 개
- flutter
{"sdk":"flutter"}
원본 README
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
README 펼치기 / 접기
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, and some Android devices (the official API does not support the feature, even on Oreo).
Android badge
Android badge
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.
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();