Text message notification APIs

更新时间:
复制 MD 格式

Introduction

To improve message delivery rates and timeliness, we offer a combined notification pattern that integrates push notifications with text messages. This pattern expands the use cases for push notifications. You can configure a fallback text message to be sent if a user does not receive or click a push notification within a specified time. For more information, see Text message interaction configuration.

To use this feature, you must bind and unbind phone numbers on the device.

Important

The software development kit (SDK) V3.0.11 and later supports binding phone numbers.

Bind a phone number

Bind the device to the phone number.

bindPhoneNumber

API definition

void bindPhoneNumber(String phoneNumber, CommonCallback callback)

Class

CloudPushService

Parameters

Parameter

Type

Required

Description

phoneNumber

String

Yes

The phone number to bind.

callback

CommonCallback

Yes

Callback.

Code examples

PushServiceFactory.getCloudPushService()
    .bindPhoneNumber(phoneNumber, object : CommonCallback() {
        override fun onSuccess(s: String?) {}
        override fun onFailed(errorCode: String?, errorMsg: String?) {}
    })
PushServiceFactory.getCloudPushService().bindPhoneNumber(phoneNumber, new CommonCallback() {
    @Override
    public void onSuccess(String s) {
        
    }

    @Override
    public void onFailed(String errorCode, String errorMsg) {
        
    }
});

Unbind a phone number

This API unbinds the current device from its bound phone number.

unbindPhoneNumber

API definition

void unbindPhoneNumber(CommonCallback callback)

Class

CloudPushService

Description

Parameter

Type

Required

Description

callback

CommonCallback

Yes

The result callback.

Code examples

PushServiceFactory.getCloudPushService()
    .unbindPhoneNumber(object : CommonCallback() {
        override fun onSuccess(s: String?) {}
        override fun onFailed(errorCode: String?, errorMsg: String?) {}
    })
PushServiceFactory.getCloudPushService().unbindPhoneNumber(new CommonCallback() {
    @Override
    public void onSuccess(String s) {
        
    }

    @Override
    public void onFailed(String errorCode, String errorMsg) {
        
    }
});