Share (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
| Parameters | Type | Explanation |
|---|---|---|
| info | INTLFriendReqInfo | Friend module's request structure Contains key input parameters like request object and request information |
| channel | String | Channel 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 variables | Type | Description | Remarks |
|---|---|---|---|
| Type | int | Friend request type (INTLFriendReqType) | Required for sharing messages, not required for adding friends. |
| User | string | The user, can be ID or OpenID | Required |
| Title | string | The title of the share | Mandatory |
| Description | string | Briefly describe the purpose of sharing | Optional |
| ImagePath | String | Image, can be a local path or URL, local path preferred | Optional |
| ThumbPath | String | Thumbnail, usually the game's icon, can be local or URL link, local path preferred | Optional |
| MediaPath | String | Multimedia (music or video), local path only supported | Optional |
| Link | String | Sharing link, can be for image, music, video or redirect links etc. | Optional |
| ExtraJson | String | Extended field | Optional |