Tag management APIs
Bind tag
Bind tags to a device to enable targeted push.
An app supports a maximum of 10,000 tags. Each tag can be up to 128 characters long.
It takes up to 10 minutes for a tag binding to take effect.
Avoid binding more than 100,000 devices to a single tag. Pushing to a tag with this many devices can cause long processing delays and unpredictable response times. Instead, use a broadcast push or segment your devices into smaller groups with more granular tags, then call the push API separately for each tag.
bindTag
Method definition
void bindTag(int target, String[] tags, String alias, CommonCallback callback)
Class
CloudPushService
Parameters
Parameter | Type | Required | Description |
target | int | Yes | The target type. Set to |
tags | String[] | Yes | An array of tags to bind. |
alias | String | No | A reserved parameter. Pass |
callback | CommonCallback | Yes | The callback that receives the operation result. |
Examples
PushServiceFactory.getCloudPushService()
.bindTag(CloudPushService.DEVICE_TARGET, arrayOf(tag), null, object : CommonCallback {
override fun onSuccess(s: String) {}
override fun onFailed(errorCode: String, errorMsg: String) {}
})PushServiceFactory.getCloudPushService().bindTag(CloudPushService.DEVICE_TARGET, new String[]{tag}, null, new CommonCallback() {
@Override
public void onSuccess(String s) {
}
@Override
public void onFailed(String errorCode, String errorMsg) {
}
});Unbind tag
Unbinds a tag from a device.
Unbinding a tag removes its association with a device but does not delete the tag itself. The system does not currently support tag deletion.
It takes up to 10 minutes for a tag unbinding to take effect.
unbindTag
Method definition
void unbindTag(int target, String[] tags, String alias, CommonCallback callback)
Class
CloudPushService
Parameters
Parameter | Type | Required | Description |
target | int | Yes | The target type. Set to |
tags | String[] | Yes | An array of tags to unbind. |
alias | String | No | A reserved parameter. Pass |
callback | CommonCallback | Yes | The callback that receives the operation result. |
Examples
PushServiceFactory.getCloudPushService()
.unbindTag(CloudPushService.DEVICE_TARGET, arrayOf(tag), null, object : CommonCallback {
override fun onSuccess(s: String) {}
override fun onFailed(errorCode: String, errorMsg: String) {}
})PushServiceFactory.getCloudPushService().unbindTag(CloudPushService.DEVICE_TARGET, new String[]{tag}, null, new CommonCallback() {
@Override
public void onSuccess(String s) {
}
@Override
public void onFailed(String errorCode, String errorMsg) {
}
});List tags
Lists the tags that are bound to a device.
listTags
Method definition
void listTags(int target, CommonCallback callback)
Class
CloudPushService
Parameters
Parameter | Type | Required | Description |
target | int | Yes | The target type. Set to |
callback | CommonCallback | Yes | The callback. The query result is provided in the |
Examples
PushServiceFactory.getCloudPushService()
.listTags(CloudPushService.DEVICE_TARGET, object : CommonCallback {
override fun onSuccess(s: String) {}
override fun onFailed(errorCode: String, errorMsg: String) {}
})PushServiceFactory.getCloudPushService().listTags(CloudPushService.DEVICE_TARGET, new CommonCallback() {
@Override
public void onSuccess(String s) {
}
@Override
public void onFailed(String errorCode, String errorMsg) {
}
});