Skip to main content

Share

AndroidiOSWindows
If you were looking for the method for use with Unity, see Share for Unity SDK.

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

ParameterTypeDescription
InfoFINTLFriendReqInfoFriend module request body
Including the request object, request information, and other important parameters.
ChannelFStringChannel 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 variableTypeDescriptionRemark
Typeint32Friend Request Type (UINTLFriendReqType)Required when sharing messages, not required when adding friends.
UserFStringCan be ID or OpenID, users need to fill in the OpenID of the specified friendRequired
TitleFStringShare titleRequired
DescriptionFStringOutline, briefly describe the purpose of sharingOptional
ImagePathFStringImage can be local address or URL, local address is recommendedOptional
ThumbPathFStringThumbnail, usually the icon of the game, either a local icon or an icon URL, it is recommended to use a local addressOptional
MediaPathFStringMultimedia (music or video), only supports local addressOptional
LinkFStringShares the link, which can be a picture, music, video or jump link,Optional
ExtraJsonFStringExtended fieldOptional