注册或 注销推送(RegisterPush/UnregisterPush)
注册 Firebase 渠道推送,可以接收 Firebase 渠道的消息推送。在绑定设备注册的基础上,同时可以绑定账号,使用指定的账号,这样可以通过后台向指定的账号发送推送消息。
注意
调用 UnregisterPush 接口注销消息推送后,将会不再收到消息,请酌情考虑调用。
函数定义
// 注册推送
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool RegisterPush(const FString channel, const FString Account = "");
// 注销推送
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool UnregisterPush(const FString Channel);
入参说明
| 参数 | 类型 | 说明 |
|---|---|---|
| Channel | FString | 渠道定义 "Firebase" |
| Account | FString | 绑定的账号 绑定后可以针对账号发送推送消息,account 不能为单个字符如“2”,“a” |
回调处理
回调处理接口是 PushBaseResultObserver。回调数据结构是 BaseResult。
回调 ID 是 kMethodIDPushRegister,kMethodIDPushUnregister。
代码示例
// 注册推送
UINTLSDKAPI::RegisterPush("Firebase");
// 注销推送
UINTLSDKAPI::UnregisterPush("Firebase");