Share
Shares a message to the user's feed, such as a Facebook timeline. If the user is already logged in, the channel parameter can be left empty.
System channel supports sharing text, links, and images at the same time. For the System channel, the sharing screen provided by the OS is opened for the user to share the content to an installed app that has implemented the system share function.
Function definition
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool Share(const FINTLFriendReqInfo Info, const FString Channel = "");
Input parameters
Parameter | Type | Description |
---|---|---|
Info | FINTLFriendReqInfo | Friend module request body Including the request object, request information, and other important parameters. |
Channel | FString | Channel definition Example: "Facebook" |
Return value
Returns a bool type to indicate whether the current OS is supported.
Observers
The callback processing interface is FriendBaseResultObserver.
The callback data structure is BaseResult.
The callback methodID is kMethodIDFriendShare
.
Code sample
For more information on supported channels, see Friend Sharing Content.
(1) Share text
FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqText;
reqInfo.Description = "INTL Service";
bool support = UINTLSDKAPI::Share(reqInfo, "System");
(2) Share links
FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqLink;
reqInfo.Link = "https://www.facebook.com/link";
bool support = UINTLSDKAPI::Share(reqInfo, "Facebook");
(3) Share pictures
FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqImage;
reqInfo.ImagePath = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
bool support = UINTLSDKAPI::Share(reqInfo, "Facebook");
(4) Share text, link, and image simultaneously
FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqImage;
reqInfo.Description = "INTL Service";
reqInfo.Link = "https://www.facebook.com/link";
reqInfo.ImagePath = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
UINTLSDKAPI::Share(reqInfo, "System");
(5) Share videos
FINTLFriendReqInfo reqInfo;
reqInfo.Type = (int32)UINTLFriendReqType::kReqVideo;
reqInfo.MediaPath = "/path/to/video";
bool support = UINTLSDKAPI::Share(reqInfo, "Facebook");
Data structure
UINTLFriendReqType: friend request type
UENUM(BlueprintType)
enum class UINTLFriendReqType :uint8 {
kReqText = 0 UMETA(DisplayName = "TEXT"),
kReqLink = 1 UMETA(DisplayName = "LINK"),
kReqImage = 2 UMETA(DisplayName = "IMAGE"),
kReqInvite = 3 UMETA(DisplayName = "INVITE"),
kReqVideo = 4 UMETA(DisplayName = "VIDEO")
};
FINTLFriendReqInfo: friend info
Member variable | Type | Description | Remark |
---|---|---|---|
Type | int32 | Friend Request Type (UINTLFriendReqType) | Required when sharing messages, not required when adding friends. |
User | FString | Can be ID or OpenID, users need to fill in the OpenID of the specified friend | Required |
Title | FString | Share title | Required |
Description | FString | Outline, briefly describe the purpose of sharing | Optional |
ImagePath | FString | Image can be local address or URL, local address is recommended | Optional |
ThumbPath | FString | Thumbnail, usually the icon of the game, either a local icon or an icon URL, it is recommended to use a local address | Optional |
MediaPath | FString | Multimedia (music or video), only supports local address | Optional |
Link | FString | Shares the link, which can be a picture, music, video or jump link, | Optional |
ExtraJson | FString | Extended field | Optional |