关注模式
阅读本文前请先完成 SDK 初始化。
好友通知设置
好友模块默认会向游戏推送好友状态及申请的通知,如果游戏需要关闭,可调用如下接口:
- Unity
- Android
- iOS
try {
await TDSFollows.DisableFriendNotification();
TapLog("关闭推送通知成功");
} catch (Exception e) {
TapLog($"关闭推送通知失败: ${e}");
}
TDSFollows.disableFriendNotification(new Callback<Void>() {
@Override
public void onSuccess(Void result) {
toast("消息推送关闭成功");
}
@Override
public void onFail(TDSFriendError error) {
toast("消息推送关闭失败 " + error.detailMessage);
}
});
void (^callback)(BOOL succeeded, NSError * error) = ^(BOOL succeeded, NSError * _Nullable error){
if (succeeded) {
[LogHelper log:LogInfoTypeDisplay :[NSString stringWithFormat:@"设置成功"]];
} else {
[LogHelper log:LogInfoTypeError :[NSString stringWithFormat:@"设置失败"]];
}
};
[TDSFollows disableFriendNotificationWithCallback:callback];
当关闭通知后,如果需要再次开启,可调用如下接口:
- Unity
- Android
- iOS
try {
await TDSFollows.EnableFriendNotification();
TapLog("关闭推送通知成功");
} catch (Exception e) {
TapLog($"关闭推送通知失败: ${e}");
}
TDSFollows.enableFriendNotification(new Callback<Void>() {
@Override
public void onSuccess(Void result) {
toast("消息推送开启成功");
}
@Override
public void onFail(TDSFriendError error) {
toast("消息推送开启失败 " + error.detailMessage);
}
});