Badge
$ ionic plugin add cordova-plugin-badge
Repo: https://github.com/katzer/cordova-plugin-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.
Supported platforms
- Android
- iOS
- Browser
- Windows
- Amazon FireOS
- Windows Phone 8
Usage
import {Badge} from 'ionic-native';
Badge.set(10);
Badge.increase();
Badge.clear();
Static Methods
clear()
Clear the badge of the app icon.
set(number)
Set the badge of the app icon.
Param | Type | Details |
---|---|---|
number |
number
|
The new badge number. |
Returns:
Promise
get()
Get the badge of the app icon.
Returns:
Promise
increase(count)
Increase the badge number.
Param | Type | Details |
---|---|---|
count |
number
|
Count to add to the current badge number |
Returns:
Promise
decrease(count)
Decrease the badge number.
Param | Type | Details |
---|---|---|
count |
number
|
Count to subtract from the current badge number |
Returns:
Promise
hasPermission()
Determine if the app has permission to show badges.
registerPermission()
Register permission to set badge notifications
Returns:
Promise