Badge
The essential purpose of badge numbers is to enable an application to inform its users that it has something for them — for example, unread messages — when the application isn’t running in the foreground.
Requires Cordova plugin: cordova-plugin-badge. For more info, please see the Badge plugin docs.
Android Note: Badges have historically only been a feature implemented by third party launchers and not visible unless one of those launchers was being used (E.G. Samsung or Nova Launcher) and if enabled by the user. As of Android 8 (Oreo), notification badges were introduced officially to reflect unread notifications. This plugin is unlikely to work as expected on devices running Android 8 or newer. Please see the local notifications plugin docs for more information on badge use with notifications.
https://github.com/katzer/cordova-plugin-badge
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation
- Capacitor
- Cordova
- Enterprise
$ npm install cordova-plugin-badge
$ npm install @awesome-cordova-plugins/badge
$ ionic cap sync
$ ionic cordova plugin add cordova-plugin-badge
$ npm install @awesome-cordova-plugins/badge
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
Supported Platforms
- Android
- Browser
- iOS
- Windows
Usage
React
Learn more about using Ionic Native components in React
Angular
import { Badge } from '@awesome-cordova-plugins/badge/ngx';
constructor(private badge: Badge) { }
...
this.badge.set(10);
this.badge.increase(1);
this.badge.clear();