Capacitor Getui Plugin
npm install @vaecebyz/capacitor-getuigetui
``bash`
npm install @vaecebyz/capacitor-getui
npx cap sync
* echo(...)
* init()
* getVersion()
* getClientId()
* setTag(...)
* turnOnPush()
* turnOffPush()
* setSilentTime(...)
* isPushTurnedOn()
* areNotificationsEnabled()
* openNotification()
* setHwBadgeNum(...)
* setOPPOBadgeNum(...)
* setVivoAppBadgeNum(...)
* addListener('onReceiveClientId', ...)
* addListener('onReceiveMessageData', ...)
* addListener('localNotificationReceived', ...)
* addListener(string, ...)
* Interfaces
TypeScript definitions mapping to native @PluginMethod methods in GetuiPlugin.java
`typescript`
echo(options: { value: string; }) => any
原样返回输入,调试用
| Param | Type |
| ------------- | ------------------------------- |
| options | { value: string; } |
Returns: any
--------------------
`typescript`
init() => any
初始化个推 SDK,返回版本与当前 clientId(若已生成)
Returns: any
--------------------
`typescript`
getVersion() => any
获取当前 SDK 版本
Returns: any
--------------------
`typescript`
getClientId() => any
获取当前设备 clientId
Returns: any
--------------------
`typescript`
setTag(options: { tags: string[]; sn?: string; }) => any
设置标签
| Param | Type |
| ------------- | --------------------------------------- |
| options | { tags: {}; sn?: string; } |
Returns: any
--------------------
`typescript`
turnOnPush() => any
打开推送
Returns: any
--------------------
`typescript`
turnOffPush() => any
关闭推送
Returns: any
--------------------
`typescript`
setSilentTime(options: { begin_hour: number; duration: number; }) => any
设定静默时间(单位:小时),begin_hour:0-23, duration: 持续小时
| Param | Type |
| ------------- | ------------------------------------------------------ |
| options | { begin_hour: number; duration: number; } |
Returns: any
--------------------
`typescript`
isPushTurnedOn() => any
查询推送是否开启
Returns: any
--------------------
`typescript`
areNotificationsEnabled() => any
系统通知权限是否开启
Returns: any
--------------------
`typescript`
openNotification() => any
打开系统通知设置页
Returns: any
--------------------
`typescript`
setHwBadgeNum(options: { num: number; }) => any
设置华为角标
| Param | Type |
| ------------- | ----------------------------- |
| options | { num: number; } |
Returns: any
--------------------
`typescript`
setOPPOBadgeNum(options: { num: number; }) => any
设置 OPPO 角标
| Param | Type |
| ------------- | ----------------------------- |
| options | { num: number; } |
Returns: any
--------------------
`typescript`
setVivoAppBadgeNum(options: { num: number; }) => any
设置 vivo 角标
| Param | Type |
| ------------- | ----------------------------- |
| options | { num: number; } |
Returns: any
--------------------
`typescript`
addListener(eventName: 'onReceiveClientId', listenerFunc: (data: { client_id?: string; online?: boolean; }) => void) => any
添加事件监听(Capacitor 自动注入类型)
| Param | Type |
| ------------------ | ------------------------------------------------------------------------- |
| eventName | 'onReceiveClientId' |
| listenerFunc | (data: { client_id?: string; online?: boolean; }) => void |
Returns: any
--------------------
`typescript`
addListener(eventName: 'onReceiveMessageData', listenerFunc: (data: any) => void) => any
| Param | Type |
| ------------------ | ----------------------------------- |
| eventName | 'onReceiveMessageData' |
| listenerFunc | (data: any) => void |
Returns: any
--------------------
`typescript`
addListener(eventName: 'localNotificationReceived', listenerFunc: (data: any) => void) => any
| Param | Type |
| ------------------ | ---------------------------------------- |
| eventName | 'localNotificationReceived' |
| listenerFunc | (data: any) => void |
Returns: any
--------------------
`typescript`
addListener(eventName: string, listenerFunc: (data: any) => void) => any
| Param | Type |
| ------------------ | ----------------------------------- |
| eventName | string |
| listenerFunc | (data: any) => void |
Returns: any
--------------------
#### PluginListenerHandle
| Prop | Type |
| ------------ | ------------------------- |
| remove` | () => any |