API | Description |
setRegistrationID | Sets the push ID used for registration ( RegistrationID). Call this before registering the push service. |
getRegistrationID | Gets the push ID ( RegistrationID) after the push service is registered successfully. |
registerPush | Registers the push service (call this API only after the app user has agreed to the privacy policy and you are ready to provide push for the user). |
unRegisterPush | Unregisters and disables the push service. |
addPushListener | Subscribes to push events, such as notification click events. |
removePushListener | Unsubscribes from push events. |
disablePostNotificationInForeground | Enable or disable notification bar alerts when the app is in the foreground (enabled by default). |
createNotificationChannel | Creates a client notification channel. This API can be used to implement a custom ringtone. |
setCustomBadgeNumber | Sets the app badge number (Huawei and iOS only). |
registerPush(sdkAppID: number, appKey: string): Promise<JSON>;
Parameter | Type | Description |
sdkAppID | number | SDKAppID of the Push app. |
appKey | string | Client key of the Push app. |
Return value | Description |
Promise | On success: {"errCode":0,"errMsg":"success","data":{"token":"xxx"}}. On failure: { errCode: number, errMsg: string }. |
unRegisterPush(): Promise<JSON>;
Return value | Description |
Promise | On success: {"errCode":0,"errMsg":"success"}. On failure: { errCode: number, errMsg: string }. |
setRegistrationID(registrationID: string): Promise<JSON>;
Parameter | Type | Required | Description |
registrationID | string | Yes | Device push ID. Changes after uninstall and reinstall. |
Return value | Description |
Promise | On success: {"errCode":0,"errMsg":"success"}. On failure: { errCode: number, errMsg: string }. |
getRegistrationID(): Promise<JSON>;
Return value | Description |
Promise | On success: {"errCode":0,"errMsg":"success","data":{"registrationID":"xxx"}}. On failure: { errCode: number, errMsg: string }. |
addPushListener(eventName: string, listener: (res: any) => void): void;
Parameter | Type | Required | Description |
eventName | string | Yes | Push event type. See Push.EventName. |
listener | (res: any) => void | Yes | Push event handler. |
removePushListener(eventName: string, listener: (res: any) => void): void;
Parameter | Type | Required | Description |
eventName | string | Yes | Push event type. See Push.EventName. |
listener | (res: any) => void | Yes | Push event handler. |
disablePostNotificationInForeground(disable: boolean): void;
Parameter | Type | Required | Description |
disable | boolean | Yes | Enable or disable notification bar alerts when the app is in the foreground (enabled by default): true: hide notification bar alerts when the app is in the foreground. false: show notification bar alerts when the app is in the foreground. |
createNotificationChannel(options: {channelID: string;channelName: string;channelDesc?: string;channelSound?: string;}): Promise<JSON>;
Parameter | Type | Required | Description |
options.channelID | String | Yes | Custom channel ID. |
options.channelName | String | Yes | Custom channel name. |
options.channelDesc | String | No | Custom channel description. |
options.channelSound | String | No | Audio file name of the custom channel ringtone, without the file extension. Place the audio file under xxx/android/nativeResources/res/raw.Example: options.channelSound = private_ring sets xxx/android/nativeResources/res/raw/private_ring.mp3 as the custom ringtone. |
Return value | Description |
Promise | On success: {"errCode":0,"errMsg":"success"}. On failure: { errCode: number, errMsg: string }. |
setCustomBadgeNumber(badgeNumber: number): Promise<JSON>;
Parameter | Type | Required | Description |
badgeNumber | number | Yes | App badge number. |
Return value | Description |
Promise | On success: {"errCode":0,"errMsg":"success"}. On failure: { errCode: number, errMsg: string }. |
피드백