このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

Client APIs

API Overview

API
Description
registerPush
Register for push service (must be called after the App user agrees to the Privacy Policy to use the push service).
unRegisterPush
Unregister to disable push service.
setRegistrationID
Set Push Device ID.
RegistrationID is the unique identification ID of the push receiving device. By default, this ID is automatically generated when the push service is successfully registered, but you can also set it manually. Note! If you call this API, make sure to call it before registerPush.
Use cases:
If you have integrated both the Chat message service and the Push service on a device, and the user login Chat userID is assumed to be "user123", if you want to push messages to "user123", you need to call this interface to set the device identification ID as follows:
Push.setRegistrationID("user123", () => {});
getRegistrationID
After successfully registering the push service, you can call this interface to obtain the unique identification ID of the push receiving device, which is the RegistrationID.
getNotificationExtInfo
Upon receiving offline push notifications, click the notification bar to pull up the App, and call this interface to get the push extension information.
addPushListener
Add a Push listener.
removePushListener
Remove a Push listener.
disablePostNotificationInForeground
When the app is in the foreground, turn on/off notification bar notifications (default is on).
createNotificationChannel
Create a client notification channel. This API can implement custom ringtone feature on the Android platform.

Interface details

Registering Push Service

API

registerPush(SDKAppID, appKey, onSuccess, onError)

Parameter description:

Parameters
Type
Description
Access Path
SDKAppID
Number
SDKAppID for Push Service Push.



appKey
String
Client key for Push Service Push.
onSuccess
Function
Callback for successful push registration.
-
onError
Function |undefined
Callback for failed push registration.
-

Unregister to disable push service

API

unRegisterPush(onSuccess, onError)

Parameter description:

Parameters
Type
Description
onSuccess
Function
Callback for successful push unregistration.
onError
Function |undefined
Callback for failed push unregistration.

Set push ID identifier RegistrationID

Note:
1. If you call this API, make sure to call it before registerPush.

API

setRegistrationID(registrationID, onSuccess)

Parameter description:

Parameters
Type
Description
registrationID
String
Customized push ID identifier.
onSuccess
Function
Callback after successfully setting the customized push ID identifier.

Get push ID identifier RegistrationID

Note:
1. If you have called the setRegistrationID interface to set the identifier ID, this interface will return the identifier ID you set, otherwise, it will return a random value generated by the Push SDK.

API

getRegistrationID(onSuccess)

Parameter description:

Parameters
Type
Description
onSuccess
Function
Callback for successfully obtaining the push ID.

Getting Push Extension Information

API

getNotificationExtInfo(onSuccess)

Parameter description:

Parameters
Type
Description
onSuccess
Function
Callback for successfully getting the clicked pass-through content.

Adding a Push Listener

API

addPushListener(eventName: string, listener: (data: any) => void);

Parameter description:

Parameters
Type
Description
eventName
String
Push Event Type.
listener
Function
Push Event Handling Method.

Removing a Push Listener

API

removePushListener(eventName: string, listener?: (data: any) => void);

Parameter description:

Parameters
Type
Description
eventName
String
Push Event Type.
listener
Function | undefined
Push Event Handling Method.

Turning On/Off Notification Bar Notifications When the App is in the Foreground

API

disablePostNotificationInForeground(disable: boolean);

Parameter description:

Parameters
Type
Description
disable
boolean
Turning On/Off Notification Bar Notifications When the App is in the Foreground, Default On:
true: Turning off notification bar notifications when the app is in the foreground
false: Turning on notification bar notifications when the app is in the foreground

Creating a Client Notification Channel

API

createNotificationChannel(options: any, onSuccess: (data: any) => void);

Parameter description:

Parameters
Type
Description
options.channelID
String
The ID of the custom channel.
OPPO: The channelID in Console -> Access Configuration.
options.channelName
String
The name of the custom channel.
options.channelDesc
String | undefined
The description of the custom channel.
options.channelSound
String | undefined
The alert tone of the custom channel, audio file name without suffix. The audio file needs to be placed in MyReactNativeApp/android/app/src/main/res/raw.
For example:
options.channelSound = private_ring, which sets MyReactNativeApp/android/app/src/main/res/raw/private_ring.mp3 as the custom alert tone.
onSuccess
Function
Callback function for successful API invocation.