Navigator: clearAppBadge() method
Badging API
Badging API
The clearAppBadge() method of the Navigator interface clears a badge on the current app's icon by setting it to nothing. The value nothing indicates that no badge is currently set, and the status of the badge is cleared.
Syntax
clearAppBadge()
Parameters
None.
Return value
A Promise that resolves with undefined.
Exceptions
InvalidStateErrorDOMException- : Thrown if the document is not fully active.
SecurityErrorDOMException- : Thrown if the call was blocked by the same-origin policy.
NotAllowedErrorDOMException- : Thrown if PermissionStatus.state is not
granted.
Examples
Once all messages in an application have been read, call clearAppBadge() to clear the badge and remove the notification.
navigator.clearAppBadge();