1.2.1 • Published 2 years ago
@robingenz/capacitor-badge v1.2.1
Maintainers
Maintainer | GitHub | Social |
---|---|---|
Robin Genz | robingenz | @robin_genz |
Installation
npm install @robingenz/capacitor-badge@next
npx cap sync
Configuration
No configuration required for this plugin.
Demo
A working example can be found here: robingenz/capacitor-plugin-demo
Usage
import { Badge } from '@robingenz/capacitor-badge';
const get = async () => {
const count = await Badge.get();
};
const set = async (count: number) => {
await Badge.set({ count });
};
const clear = async () => {
await Badge.clear();
};
API
get()
get() => Promise<GetBadgeResult>
Get the badge count. The badge count won't be lost after a reboot or app restart.
Default: 0
.
Returns: Promise<GetBadgeResult>
set(...)
set(options: SetBadgeOptions) => Promise<void>
Set the badge count.
Param | Type |
---|---|
options | SetBadgeOptions |
clear()
clear() => Promise<void>
Clear the badge count.
checkPermissions()
checkPermissions() => Promise<PermissionStatus>
Check permission to display badge.
Returns: Promise<PermissionStatus>
requestPermissions()
requestPermissions() => Promise<PermissionStatus>
Request permission to display badge.
Returns: Promise<PermissionStatus>
Interfaces
GetBadgeResult
Prop | Type |
---|---|
count | number |
SetBadgeOptions
Prop | Type |
---|---|
count | number |
PermissionStatus
Prop | Type | Description |
---|---|---|
display | PermissionState | Permission state of displaying the badge. |
Type Aliases
PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
Quirks
On Android not all launchers support badges. This plugin uses ShortcutBadger. All supported launchers are listed there.
Changelog
See CHANGELOG.md.
License
See LICENSE.
1.2.1-dev.0c1c23b.1659199300
2 years ago
1.2.1-dev.6111d44.1659196262
2 years ago
1.2.1
2 years ago
1.2.0
3 years ago
1.1.0-dev.81adfd8.1627410486
3 years ago
1.1.0
3 years ago
1.0.0-dev.490c1cd.1627392095
3 years ago
1.0.0
3 years ago
0.0.1-dev.794e40f
3 years ago
0.0.1
3 years ago
0.0.1-dev.6847754
3 years ago