跳到主要内容

发送消息给指定好友(SendMessage)

AndroidiOSWindows
如果您使用的是 Unity 引擎,请参见 Unity SDK 的 SendMessage

发送消息给指定好友,已经登录的情况下,渠道入参可以不填写。

函数定义

UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool SendMessage(const FINTLFriendReqInfo Info, const FString Channel="");

入参说明

参数类型说明
InfoFINTLFriendReqInfo好友模块请求结构体
主要包含请求对象,请求信息等重要入参
ChannelFString渠道信息
比如 "Facebook"

返回值

回调 ID 是 kMethodIDAuthLaunchAccountUI

回调处理

回调处理接口是 FriendBaseResultObserver。回调数据结构是 BaseResult

回调 ID 是 kMethodIDFriendSendMessage

代码示例

更多关于支持渠道,请参见 好友直接信息

(1) 发送文本

FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqText;
reqInfo.Description = "INTL Service";
bool support = UINTLSDKAPI::SendMessage(reqInfo, "QQ");

(2) 发送链接

FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqLink;
reqInfo.Link = "https://www.facebook.com";
bool support = UINTLSDKAPI::SendMessage(reqInfo, "Facebook");

(3) 发送图片

FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqImage;
reqInfo.ImagePath = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
bool support = UINTLSDKAPI::SendMessage(reqInfo, "QQ");

(4) 发送邀请

FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqInvite;
reqInfo.Link = "https://www.facebook.com/link";
bool support = UINTLSDKAPI::SendMessage(reqInfo, "Facebook");

(5) 发送视频

FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqVideo;
reqInfo.MediaPath = "path/to/video";
bool support = UINTLSDKAPI::SendMessage(reqInfo, "QQ");