SMS notification API (3.x)
This topic applies to Android SDK 3.x. For the minimum supported version, see the description of each API. Any mention of and later versions in this topic applies only within the 3.x range. For apps that use 4.x, see SMS notification API (4.x).
Introduction
This feature offers a hybrid model that integrates push notifications with SMS notifications. This approach improves message delivery rates, increases timeliness, and expands push notification use cases. You can configure a time window for the system to send an SMS notification as a fallback if a user does not receive or tap a push notification. For details, see SMS integration configuration.
To implement this integrated solution, your app needs to bind and unbind phone numbers on the client.
SDK V3.0.11 and later support phone number binding.
Bind a phone number
Binds a device to a 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 |
The callback that receives the operation result. |
Code sample
PushServiceFactory.getCloudPushService().bindPhoneNumber(phoneNumber, new CommonCallback() {
@Override
public void onSuccess(String s) {
}
@Override
public void onFailed(String errorCode, String errorMsg) {
}
});PushServiceFactory.getCloudPushService()
.bindPhoneNumber(phoneNumber, object : CommonCallback() {
override fun onSuccess(s: String?) {}
override fun onFailed(errorCode: String?, errorMsg: String?) {}
})Unbind a phone number
Unbinds the current device from its associated phone number.
unbindPhoneNumber
API definition
void unbindPhoneNumber(CommonCallback callback)
Class
CloudPushService
Parameters
|
Parameter |
Type |
Required |
Description |
|
callback |
CommonCallback |
Yes |
The callback that receives the operation result. |
Code sample
PushServiceFactory.getCloudPushService().unbindPhoneNumber(new CommonCallback() {
@Override
public void onSuccess(String s) {
}
@Override
public void onFailed(String errorCode, String errorMsg) {
}
});PushServiceFactory.getCloudPushService()
.unbindPhoneNumber(object : CommonCallback() {
override fun onSuccess(s: String?) {}
override fun onFailed(errorCode: String?, errorMsg: String?) {}
})