Skip to main content

Share (Share)

[Player Network SDK & MSDK]

Send a message to a specified friend. If already logged in, the channel parameter can be left empty.

When the channel is System, the system share menu will open, allowing the user to choose to share content to the corresponding app, which must support system sharing. When the channel is System, text, links, and images can be shared simultaneously.

Supported Platforms

Supports Android, iOS, Windows platform.
note

MSDK does not support Windows yet

Function Definition

void Share(GUAFriendReqInfo info, string channel = "");

Input Parameters

ParametersTypeDescription
DescriptionFriend Request (GUAFriendReqInfo)Friend Module Request Structure
Primarily includes the request object, request information, and other essential input parameters
channelstringChannel information
Such as "Facebook"

Callback Handling

The callback handler interface is GUAFriendBaseResultObserver.The callback data structure is GUABaseResult.

The callback event is FriendBaseEvents. The callback ID is GUA_FRIEND_SHARE.

Code Example

Refer to the enumeration structure GUAFriendReqType.

(1) Share text, supports System

var reqInfo = new GUAFriendReqInfo
{
Type = FriendReqType.Friend_REQ_TEXT,
Description = "description"
};
UnionAdapterAPI.GetFriendService().Share(reqInfo);

(2) Share link, supports Facebook, System

var reqInfo = new GUAFriendReqInfo
{
Type = FriendReqType.Friend_REQ_LINK,
Link = "https://www.facebook.com/link"
};
UnionAdapterAPI.GetFriendService().Share(reqInfo);

(3) Share image, supports Facebook, System

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

(4) Share text, link and image, supports System

var reqInfo = new GUAFriendReqInfo
{
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"
};
UnionAdapterAPI.GetFriendService().Share(reqInfo);

(5) Share video, supports Facebook

var reqInfo = new GUAFriendReqInfo
{
Type = FriendReqType.Friend_REQ_VIDEO,
MediaPath = "/path/to/video"
};
UnionAdapterAPI.GetFriendService().Share(reqInfo);