Badge

Improve this doc

$ 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

Usage

import { Badge } from 'ionic-native';


Badge.set(10);
Badge.increase();
Badge.clear();

Static Members

clear()

Clear the badge of the app icon.

Returns: Promise<boolean>

set(badgeNumber)

Set the badge of the app icon.

Param Type Details
badgeNumber number

The new badge number.

Returns: Promise<any>

get()

Get the badge of the app icon.

Returns: Promise<any>

increase(increaseBy)

Increase the badge number.

Param Type Details
increaseBy number

Count to add to the current badge number

Returns: Promise<any>

decrease(decreaseBy)

Decrease the badge number.

Param Type Details
decreaseBy number

Count to subtract from the current badge number

Returns: Promise<any>

hasPermission()

Determine if the app has permission to show badges.

Returns: Promise<any>

registerPermission()

Register permission to set badge notifications

Returns: Promise<any>

API

Native

General