Class
| ZPNsManager | ZPNsEventHandler |
| ZPNsMessageReceiver |
ZPNsManager
Details
ZPNsManager SDK main class.
Methods
getVersion
static getVersion(): stringIf you encounter an abnormality during the running of the SDK, you can submit the problem, log and other information to the ZEGO technical staff to locate and troubleshoot. Developers can also collect current SDK version information through this API, which is convenient for App operation statistics and related issues.
- When to call:Any time.
- Caution:None.
- Available since:1.0.0
- Restrictions:None.
SDK version.
setPushConfig
static setPushConfig(config: ZPNsConfig): voidParameters
| Name | Type | Description |
|---|---|---|
| config | ZPNsConfig |
Details
Set push Settings for each vendor.
- Use cases:Developers need to use this method to set up configurations pushed by vendors.
- Caution:Called when vendor push needs to be set.
- Available since:2.0.0 or later.
getInstance
static getInstance(): ZPNs- Supported Versions:2.0.0 and above. Detailed Description: When using the ZPNs SDK, developers shall directly call this API to obtain the internal singleton object instead of creating and maintaining the object on their own.
- Calling Timing:Any time.
- Usage Restrictions:None.
- Caution:This method must be used to get the ZPNs singleton object when utilizing ZPNs.
SDK singleton object for subsequent API calls
setBackgroundMessageHandler
static setBackgroundMessageHandler(handler: ZPNsBackgroundMessageHandler): voidParameters
| Name | Type | Description |
|---|---|---|
| handler | ZPNsBackgroundMessageHandler | Function to receive offline silent push notifications. |
- Supported versions:2.0.0 and above. Detailed description: After the App is terminated, set callbacks in non-UI components to receive offline silent push notifications.
- Usage restrictions:Only FCM offline push is supported.
- Caution:This interface is not yet supported by the uni-app SDK.
enableDebug
static enableDebug(isDebug: boolean): voidParameters
| Name | Type | Description |
|---|---|---|
| isDebug | boolean | Switch test mode. |
Details
whether to enable debug mode.
- Supported versions:2.0.0 and above.
on<K extends keyof ZPNsEventHandler>
on<K extends keyof ZPNsEventHandler>(type: K, listener: ZPNsEventHandler[K]): voidParameters
| Name | Type | Description |
|---|---|---|
| type | K | Event type. |
| listener | ZPNsEventHandler[K] | Custom callback method after event occurs. |
- Supported versions:2.0.0 and above. Detailed description: Configure event notification callbacks to listen for callbacks such as successful ZPNs registration events and push notification clicks.
- Usage restrictions:None.
off<K extends keyof ZPNsEventHandler>
off<K extends keyof ZPNsEventHandler>(type: K, listener: ZPNsEventHandler[K]): voidParameters
| Name | Type | Description |
|---|---|---|
| type | K | Event type. |
| listener | ZPNsEventHandler[K] | Custom callback method after event occurs. |
- Supported versions:2.0.0 and above.
registerPush
registerPush(config: ZPNsRegisterConfig): voidParameters
| Name | Type | Description |
|---|---|---|
| config | ZPNsRegisterConfig | ZPNs registration configuration. |
Details
This method is used to register vendor offline push.
- Use cases:This method is called when a developer needs to use offline push.
- Available since:ZPNs 2.0.0 or later.
unregisterPush
unregisterPush(): voidCall this method to de-register when offline push is not required.
- Use cases:This method can be called to de-register when a user clicks a close message notification within the application. When to call /Trigger: Called when de-registration is required.
- Caution:It needs to be called after [registerPush] is called.
- Available since:2.0.0 or later.
applyNotificationPermission
applyNotificationPermission(): voidApply for push notification permission from the system. If the API is not called or the user chooses to decline after calling, the push notification will not be received. It is recommended to call Ask permission when the app is opened.
createNotificationChannel
createNotificationChannel(channel: ZPNsNotificationChannel): voidParameters
| Name | Type | Description |
|---|---|---|
| channel | ZPNsNotificationChannel | Object used to create notification channels. |
Details
For Android 8.0 or later, you can invoke this API to create a notification channel. For details, please refer to Google Official document.
addLocalNotification
addLocalNotification(request: UNNotificationRequest *, message: ZPNsLocalMessage): voidParameters
| Name | Type | Description |
|---|---|---|
| request | UNNotificationRequest * | Please refer to Apple's official documentation UNNotificationRequest. |
| message | ZPNsLocalMessage |
Details
When the developer's App is in the foreground or has just been pushed to the background and is not frozen, the background will not send offline pushes if the background does not perceive that the user is offline. At this time, if the developer needs to supplement the push notification, he can use this interface to manually send a local push message to the device.
setLocalBadge
setLocalBadge(badge: number): voidParameters
| Name | Type | Description |
|---|---|---|
| badge | number | The value to be set. |
Details
Set the number of app local corner markers.It supports Apple's related APIs .
- Use cases:Called when the developer needs to modify the number of local corner markers.
- Default value:None.
- Available since:ZPNs version 2.6.0 or later.
setServerBadge
setServerBadge(badge: number): voidParameters
| Name | Type | Description |
|---|---|---|
| badge | number | The value to be set. |
- Available since version 2.6.0 or later. Description the number of corners of the current App to the ZPNs server through this interface. When the app is offline, the ZPNs changes based on the previously reported corner mark number.
- Use cases:When the local corner of the developer is changed, this interface is called to report the change. Default value the receiver does not report the badge, the corner mark will not be modified when the push is sent. When to call /Trigger can be called at any time, but the actual time reported to the background is after pushID has successfully registered and the user has logged in, and before logging out.
- Caution:Badge cannot be less than 0.
- Restrictions:There is no single interface frequency limit. Currently, you need to configure this interface only for iOS.
ZPNsEventHandler
Details
Methods
registered
onRegistered(): void- Available since:2.0.0.
ZPNsMessageReceiver
Details
ZPNsManager SDK event handler class.
Methods
notificationClicked
onNotificationClicked(): void- Available since:2.0.0.
notificationArrived
onNotificationArrived(): void- Available since:2.0.0.
throughMessageReceived
onThroughMessageReceived(): void- Available since:2.0.0.
