In-app Chat
On this page

Class

2026-07-06
ZPNsManagerZPNsEventHandler
ZPNsMessageReceiver

ZPNsManager

Details

ZPNsManager SDK main class.

Methods

getVersion

static
getVersion
static getVersion(): string
Gets the SDK's version number.

If 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
static setPushConfig(config: ZPNsConfig): void
Set push Settings for each vendor.

Parameters

NameTypeDescription
configZPNsConfig

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
static getInstance(): ZPNs
Get the ZPNs instance.
  • 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
static setBackgroundMessageHandler(handler: ZPNsBackgroundMessageHandler): void
After the android app is killed, receive offline silent push notifications.

Parameters

NameTypeDescription
handlerZPNsBackgroundMessageHandlerFunction 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
static enableDebug(isDebug: boolean): void
Whether to enable debug mode.

Parameters

NameTypeDescription
isDebugbooleanSwitch 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>
on<K extends keyof ZPNsEventHandler>(type: K, listener: ZPNsEventHandler[K]): void
Set the callback for ZPNs push event notifications.

Parameters

NameTypeDescription
typeKEvent type.
listenerZPNsEventHandler[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>
off<K extends keyof ZPNsEventHandler>(type: K, listener: ZPNsEventHandler[K]): void
Cancel the setup of the ZPNs push event notification callback

Parameters

NameTypeDescription
typeKEvent type.
listenerZPNsEventHandler[K]Custom callback method after event occurs.
  • Supported versions:2.0.0 and above.

registerPush

registerPush
registerPush(config: ZPNsRegisterConfig): void
This method is used to register vendor offline push.

Parameters

NameTypeDescription
configZPNsRegisterConfigZPNs 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
unregisterPush(): void
Call this method to de-register when offline push is not required.

Call 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
applyNotificationPermission(): void
Apply for push notification permission from the system

Apply 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
createNotificationChannel(channel: ZPNsNotificationChannel): void
On Android platform, create a notification channel.

Parameters

NameTypeDescription
channelZPNsNotificationChannelObject 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
addLocalNotification(request: UNNotificationRequest *, message: ZPNsLocalMessage): void
Add a local push notification.

Parameters

NameTypeDescription
requestUNNotificationRequest *Please refer to Apple's official documentation UNNotificationRequest.
messageZPNsLocalMessage

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
setLocalBadge(badge: number): void
Set the number of app local badge markers.

Parameters

NameTypeDescription
badgenumberThe 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
setServerBadge(badge: number): void
Reports the number of corners of the current App to the ZPNs server through this interface.

Parameters

NameTypeDescription
badgenumberThe 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

registered
onRegistered(): void
  • Available since:2.0.0.

ZPNsMessageReceiver

Details

ZPNsManager SDK event handler class.

Methods

notificationClicked

notificationClicked
onNotificationClicked(): void
  • Available since:2.0.0.

notificationArrived

notificationArrived
onNotificationArrived(): void
  • Available since:2.0.0.

throughMessageReceived

throughMessageReceived
onThroughMessageReceived(): void
  • Available since:2.0.0.

Previous

Function Overview

Next

Interface

On this page

Back to top