Skip to main content

Share (Share)

AndroidiOSWindows
If you are using Unreal Engine, see Unreal Engine SDK's Share.

Send messages to the information wall, such as Facebook, without needing to fill in channel input parameters when already logged in.

When the channel is System, the system share menu will open, allowing users to choose to share content with the corresponding APP, provided the APP supports system sharing.When the channel is System, you can share text, links, and images simultaneously.

Function Definition

public static void Share(INTLFriendReqInfo info, string channel = "");

Input Parameters

ParametersTypeExplanation
infoINTLFriendReqInfoFriend module's request structure
Contains key input parameters like request object and request information
channelStringChannel information
Such as "Facebook"

Return Value

No return value.

Observers

Callback handling interface is FriendBaseResultObserver.
The callback data structure is BaseResult.

The callback ID is INTL_FRIEND_SHARE.

Code Sample

For more information on supported channels, see Friend Sharing Content.

(1) Share text

var reqInfo = new INTLFriendReqInfo
{
Type = FriendReqType.Friend_REQ_TEXT,
Description = "INTL description"
};
INTLAPI.Share (reqInfo, INTLChannel.System);

(2) Share link

var reqInfo = new INTLFriendReqInfo
{
Type = FriendReqType.Friend_REQ_LINK,
Link = "https://www.facebook.com/link"
};
INTLAPI.Share (reqInfo, INTLChannel.Facebook);

(3) Share image

var reqInfo = new INTLFriendReqInfo
{
Type = FriendReqType.Friend_REQ_IMAGE,
ImagePath = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
};
INTLAPI.Share (reqInfo, INTLChannel.Facebook);

(4) Share text, link, and image

var reqInfo = new INTLFriendReqInfo
{
Type = FriendReqType.Friend_REQ_IMAGE,
Description = "INTL Description",
Link = "https://www.facebook.com/link",
ImagePath = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
};
INTLAPI.Share (reqInfo, INTLChannel.System);

(5) Share video

var reqInfo = new INTLFriendReqInfo
{
Type = FriendReqType.Friend_REQ_VIDEO,
MediaPath = "/path/to/video"
};
INTLAPI.Share (reqInfo, INTLChannel.Facebook);

Data Structure

INTLFriendReqType: Friend request type

public enum INTLFriendReqType
{
Friend_REQ_TEXT = 10000, //Text share
Friend_REQ_LINK, //Link share
Friend_REQ_IMAGE, //Image share
Friend_REQ_INVITE, //App invitation
Friend_REQ_VIDEO, //Video share
}

INTLFriendReqInfo: Friend info

Member variablesTypeDescriptionRemarks
TypeintFriend request type (INTLFriendReqType)Required for sharing messages, not required for adding friends.
UserstringThe user, can be ID or OpenIDRequired
TitlestringThe title of the shareMandatory
DescriptionstringBriefly describe the purpose of sharingOptional
ImagePathStringImage, can be a local path or URL, local path preferredOptional
ThumbPathStringThumbnail, usually the game's icon, can be local or URL link, local path preferredOptional
MediaPathStringMultimedia (music or video), local path only supportedOptional
LinkStringSharing link, can be for image, music, video or redirect links etc.Optional
ExtraJsonStringExtended fieldOptional