05/15/2024 15:19:45

Share Module

I. Overview

The Share module is a social function module of MSDK. Its main functions include:

  1. The message sending function; message types include friend invitation, text, link, image, music, video, miniApp, Video Channel, state, etc. Some types of message in WeChat channel can be sent to designated friends.
  2. The share function (WeChat Moment, WeChat Game Circle, QZone, Facebook TimeLine, Twitter). Types of shared messages include text, image, link, invitation, music and video.

Supported channels are:

  1. WeChat
  2. QQ
  3. Facebook
  4. Twitter
  5. System
  6. Line
  7. WhatsApp
  8. Kwai
  9. Instagram


The message delivery function is divided into two categories:

  • Send messages by the Silence mode: share messages directly after calling API. The silence delivery process is executed in the app's backend and it has no popup window
  • Send messages by the Dialog mode: a share box will pop up after API is called. The user needs to make further operations to share messages
Delivery type WeChat friends WeChat State WeChat Video Channel QQ Small World QQ friends Facebook Twitter System Line SMS WhatsApp Kwai
text (Friend_REQ_TEXT) Supported Supported in iOS Supported Supported Supported
link (Friend_REQ_LINK) Supported Supported Supported Supported Supported
image (Friend_REQ_IMG) Supported Supported Supported Supported in Android
video (Friend_REQ_VIDEO) Supported in Android
invitation (Friend_REQ_INVITE) Supported Supported Supported
music (Friend_REQ_MUSIC) Supported Supported
miniApp (Friend_REQ_MINI_APP) Supported Support(5.6.000 version and above)
Silence invitation (Friend_REQ_INVITE_SILENT) Supported
miniApp launch (FRIEND_REQ_PULL_UP_MINI_APP) Supported Supported (version 5.30.000 and above)
ark sharing (Friend_REQ_ARK) Supported
business function launch (Friend_REQ_OPEN_BUSINESS_VIEW) Supported
State (Friend_REQ_WX_STATE_PHOTO) Supported
WeChat Video Channel (Friend_REQ_WX_CHANNEL_START_LIVE) Supported
QQ Small World(Friend_REQ_QQ_COMMON_SHARE) Supported
WeChat native sharing (Friend_REQ_WX_NATIVE_GAME_PAGE) Support

Note: Facebook no longer supports sending messages to Messenger, so MSDK no longer maintains Facebook sendMessage interface. Various project teams please use it with caution.

Share type WeChat Moment WeChat Gameline WeChat Video Channel WeChat State QZone Facebook Twitter System Line Kwai Instagram
text (Friend_REQ_TEXT) Supported Supported Supported in Android Supported Supported in Android
link (Friend_REQ_LINK) Supported Supported Supported Supported in Android Supported in iOS
image (Friend_REQ_IMG) Supported Supported Supported Supported in Android Supported in Android
music (Friend_REQ_MUSIC) Supported
invitation (Friend_REQ_INVITE) Supported
video (Friend_REQ_VIDEO) Supported in Android
(MSDK5.7.001 and higher versions supported in iOS)
Supported Supported
WeChat Game Circle's image sharing (Friend_REQ_WX_GAMELINE) Supported
miniApp (Friend_REQ_MINI_APP) Supported(MSDK5.6.000 and higher versions supported)
WeChat Video Channel (Friend_REQ_WX_CHANNEL_SHARE_VIDEO) Supported
State (Friend_REQ_WX_STATE_PHOTO) Supported WeChat native sharing (Friend_REQ_WX_NATIVE_GAME_PAGE) Support

II. Guide on how to access the module

2.1 Register the callback

1) Functional description

For the callback of MSDK's Friend module, the game needs to register a callback function for processing. The information drawn from the platform side may have delays. QQ is real-time, WeChat may have delay, and the delay time is 0-4 hours.

2) Interface declaration

C#
C++
/// Callback of the basic result																	
public static event OnMSDKRetEventHandler<MSDKBaseRet> FriendRetEvent;																	
																	
/// Callback for finding friends																	
public static event OnMSDKRetEventHandler<MSDKFriendRet> QuereyFriendEvent;
class MSDKFriendObserver																	
{																	
public:																	
	/// Callback of the basic result																
    virtual void OnDeliverMessageNotify(const MSDKBaseRet &baseRet) {};																	
    /// Callback for finding friends																	
    virtual void OnQueryFriendNotify(const MSDKFriendRet &friendRet) {};																	
};

3) Demo code

C#
C++
MSDKFriend.FriendRetEvent += OnFriendRetEvent;																	
MSDKFriend.QuereyFriendEvent += OnQuereyFriendEvent;																	
																	
public void OnFriendRetEvent(MSDKBaseRet baseRet)																	
{																	
	string methodTag = "";																
																	
	if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_FRIEND_SHARE) {																
		methodTag = "Share";															
	} else if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_FRIEND_SEND_MESSAGE) {																
		methodTag = "SendMessage";															
	} else if (baseRet.MethodNameId == (int)MSDKMethodNameID.MSDK_FRIEND_ADD_FRIEND) {																
		methodTag = "AddFriend";															
	}																
																	
	SampleInstance.showRetDialog(methodTag, baseRet);																
}																	
																	
public void OnQuereyFriendEvent(MSDKFriendRet friendRet)																	
{																	
	string methodTag = "";																
	if (friendRet.MethodNameId == (int)MSDKMethodNameID.MSDK_FRIEND_QUERY_FRIEND) {																
		methodTag = "QueryFriends";															
	}																
	SampleInstance.showRetDialog(methodTag, friendRet);																
}																	
																	
// It is needed to remove the listener when destroy																
private void OnDestroy()																	
{																	
	MSDKFriend.FriendRetEvent -= OnFriendRetEvent;																
	MSDKFriend.QuereyFriendEvent -= OnQuereyFriendEvent;																
}
MSDKFriend::SetFriendObserver(new MyFriendObserver());																	
																	
// The Friend module's listener																	
class MyFriendObserver : public MSDKFriendObserver {																	
public:																	
    void OnDeliverMessageNotify(const MSDKBaseRet &baseRet) {																	
        String ret = MSDKUtils::FormatJson(MSDKJsonManager::ToJson(baseRet));																	
        UMSDKDemoBase::showNormalAlert(ret);																	
    };																	
    void OnQueryFriendNotify(const MSDKFriendRet &friendRet) {																	
        String ret = MSDKUtils::FormatJson(MSDKJsonManager::ToJson(friendRet));																	
        UMSDKDemoBase::showNormalAlert(ret);																	
    };																	
};

4) Data structure

Details about MSDKFriendRet

It inherits MSDKBaseRet and contains basic information

Member variable name Type Description
friendInfoList List<MSDKPersonInfo> Friends list

2.2 Send a message to a friend

1) Functional description

Send a message to a specified friend. If you have logged in MSDK, you can leave the channel's input parameters blank.

[danger]
Facebook no longer supports sending messages to Messenger, so MSDK no longer maintains Facebook sendMessage interface. Various project teams please use it with caution.

Facebook-related documentation: https://developers.facebook.com/docs/sharing/messenger

Under the WeChat channel, the following types can be sent to designated friends: text, image, music, link, invitation and miniApp. You need to include the designated friend's openid in the request struct. If openid is empty, the WeChat friends list will be launched.

openid is divided into two types:

Gotten from the backend Usage
gopenid Only WeChat in-game friends can get goponid To use goopenid for sharing, you can add {"isFriendInGame":true} to extraJson (optional)
sopenid WeChat friends (in-game friends and non-in-game friends) can get openid To use sopenid for sharing, you must add {"isFriendInGame":false} to extraJson (required)

[warning] Sharing among designated friends Precautions

Currently, WeChat APP 6.7.2 and higher versions are required to support the targeted sharing among designated friends.

When the version of WeChat APP is too low, it is not supported to direct the designated friends to share. After launching WeChat, the "Unsupported sharing type" or "Unknown application request" page will appear.

2) Interface declaration

C#
C++
public static void SendMessage(MSDKFriendReqInfo info, string channel = "")
public static void SendMessage(const MSDKFriendReqInfo &reqInfo, const string &channel = "");

3) Description of input parameters

Parameter name Parameter type Description
info MSDKFriendReqInfo The Friend module's request struct, which mainly contains important input parameters such as the request object and request information
channel string channel information, such as "WeChat", "QQ", "Line"

4) Demo code

1、Send text. This function supports WeChat and Line

Warining:

  1. The directional sharing of the text only supports WeChat. It is allowed to pass in the openid of the target object through User
  2. The size of the text shared by WeChat channel cannot exceed 10k
Parameter name Parameter type Parameter Description
Type int Message type specified by sharing, required
Desc string Overview, which simply describes the purpose of sharing, required
User string When sopenid is used, it is required to add {\"isFriendInGame\": false} in extraJson; when gopenid is used, it is allowed to add {\"isFriendInGame\": true} in extraJson; (optional)

C#
C++
var reqInfo = new MSDKFriendReqInfo																	
{																	
	Type = FriendReqType.Friend_REQ_TEXT,																
	Desc = "MSDK is a platform for the Value Added Service Department of Interactive Entertainment Business Group to provide public components and service libraries for games",																
	// The demo of how to use sopenid to specify WeChat friends for sharing:																
	User = "WeChat friend's sopenid",																
	ExtraJson = "{\"isFriendInGame\":false}"; // Required																
	// The demo of how to use sopenid to specify WeChat friends for sharing comes to an end																
};																	
MSDKFriend.SendMessage (reqInfo, "WeChat");
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypeText;																	
info.desc = "MSDK is a platform for the Value Added Service Department of Interactive Entertainment Business Group to provide public components and service libraries for games";																	
// The demo of how to use sopenid to specify WeChat friends for sharing:																	
info.user = "WeChat friend's sopenid",																	
info.extraJson = "{\"isFriendInGame\":false}";  // Required																	
// The demo of how to use sopenid to specify WeChat friends for sharing comes to an end																	
MSDKFriend::SendMessage(info, "WeChat");

2、Send links. This function supports WeChat and QQ

Note: Link directed sharing supports WeChat and Kwai; it can pass in the openid of the target object through 'User'

Parameter name Type Parameter Description
Type int Message type specified by sharing, required
User string When sopenid is used, it is required to add {\"isFriendInGame\": false} in extraJson; when gopenid is used, it is allowed to add {\"isFriendInGame\": true} in extraJson; (optional)
Title string Shared message's title, optional (Required for Kwai channel)
Desc string Shared message's content, optional (Required for Kwai channel)
Link string Shared message's link, required
ThumbPath string thumbnail's URL, optional (Required for Kwai channel)
ExtraJson string Extension field, used for the transmitted game_data field, optional
game_data string The game-defined transmitted data, which only supports QQ, optional

C#
C++
var reqInfo = new MSDKFriendReqInfo																	
{							
    Title ="Shared message's title", 	
    Type = FriendReqType.Friend_REQ_LINK,	
    Link = "https://www.qq.com",	
    ThumbPath ="Thumbnail URL", 		
    // When WeChat makes directional sharing, User is a required parameter 	
    User ="gopenid or sopenid", 	
    // When User passes in sopenid, isFriendInGame is a required field 	
    ExtraJson ="{\"isFriendInGame\": false, \"game_data\": \"gamer-defined data \"}"																
};																	
MSDKFriend.SendMessage (reqInfo, "WeChat");
MSDKFriendReqInfo info;	
info.title ="Shared message's title"; 	
info.type = kMSDKFriendReqTypeLink;	
info.link = "https://www.qq.com";	
// When WeChat makes directional sharing, User is a required parameter 	
info.user ="gopenid or sopenid"; 	
// When User passes in sopenid, isFriendInGame is a required field 	
info.thumbPath ="Thumbnail URL"; 	
info.extraJson ="{\"isFriendInGame\": false, \"game_data\": \"gamer-defined data \"}"; 	
MSDKFriend::SendMessage(info, "QQ");

3、Send images. This function supports WeChat, QQ and Line, WhatsApp (Android platform only), Garena

Warning:

  1. QQ channel's image size cannot exceed 1M
  2. WeChat channel's image size cannot exceed 3M
  3. When sending an image, you should match the file_provider_paths.xml configuration with the storage location of the image. For details, please refer to: Android fails to send a big picture, reporting an error "Failed to find configured root"
Parameter name Type Parameter Description
Type int Message type specified by sharing, required
User string When sopenid is used, it is required to add {\"isFriendInGame\": false} in extraJson; when gopenid is used, it is allowed to add {\"isFriendInGame\": true} in extraJson; (optional)
ImagePath string The path of the image; the field supports local or network images, required
ThumbPath string Thumbnail path; in versions before MSDK 5.13, the image size did not exceed 32k; in MSDK 5.13 and later versions, the image size does not exceed 128k; required for iOS, but optional for Android
ExtraJson string Extension field, used for the transmission of the isFriendInGame field, optional

C#
C++
var reqInfo = new MSDKFriendReqInfo																	
{																	
	Type = FriendReqType.Friend_REQ_IMG,	
    // When WeChat makes directional sharing, User is a required parameter 	
    User ="gopenid or sopenid", 	
    // When User passes in sopenid, isFriendInGame is a required field 	
    ExtraJson = "{\"isFriendInGame\":false}",	
    ImagePath ="/storage/emulated/0/Android/data/ game package name /img.png"	
};																	
MSDKFriend.SendMessage (reqInfo, "Line");
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypeIMG;	
// When WeChat makes directional sharing, User is a required parameter 	
info.user ="gopenid or sopenid"; 	
// When User passes in sopenid, isFriendInGame is a required field 	
info.extraJson ="{\"isFriendInGame\": false}"; 	
info.imagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";	
MSDKFriend::SendMessage(info, "WeChat");

4、Send a miniApp. This function supports WeChat, QQ (QQ is supported since 5.6.000 version)

  • WeChat channel
Parameter name Type Parameter Description
Type int Message type specified by sharing, required
Link string The URL (any URL can be filled in) of the page redirected when miniApp is opened in the old version of WeChat, required
ThumbPath string thumbnail path,In versions before MSDK 5.13, the image size did not exceed 32k; in MSDK 5.13 and later versions, the image size cannot exceed 128k; required
ExtraJson string extension field, used for the transmission of media_tag_name, game_data , weapp_id and mini_program_type fields, required
weapp_id string Original ID of the miniApp, such as gh_e9f675597c15, required
mini_program_type string Specify the miniApp version, which is divided into three types of versions: Release(0), Test(1), Preview(2), corresponding to miniApp version, optional
media_tag_name string This value will be passed to WeChat for statistics use. For details, click here, optional
game_data string The user-defined value passed in when the game shares a message. The value will be passed back to the game through the extension field in the wakeup callback of the app when the game is launched through the message. It is a transmitted parameter. You can fill in an empty string if you don't need it. Examples for filling in: \"game_data\": {\"loobyid\": \"123456\", \"roomid\": \"123456\"} or \"game_data\": \"gameData\, optional
  • QQ channel
Parameter name Type Parameter Description
Type int Message type specified by sharing, required
Title string Shared miniApp's title, required
Desc string Shared miniApp's content description, required
Link string The URL (any URL can be filled in) of the page redirected when miniApp , required
ThumbPath string thumbnail path, required
ExtraJson string Extension field, used for the transmission of mini_appid, mini_path, mini_webpage_url and mini_program_type fields, required
mini_appid string AppId of miniApp (Note: The miniApp must be bound to the shared App in the QQ interconnection platform), required
mini_path string The display path of miniApp; if this path is left blank, the homepage of miniApp will be woken up by default; The path can carry parameters, for example: pages/main/index?a=123&b=123,required
mini_webpage_url string Be compatible with lower versions of webpage link; MSDK can automatically assign the link's value to mini_webpage_url (when shared to QZone, the link's value will be assigned to the targetURL); the game does not need to pass in the parameter in extraJson; optional
mini_program_type string The type of miniApp, defaulted as official version (3), optional test version (1); optional

C#
C++
// WeChat miniApp sharing	
var reqInfo = new MSDKFriendReqInfo	
{	
    Type = FriendReqType.Friend_REQ_MINI_APP,	
    ThumbPath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png",	
    ExtraJson = "{\"media_tag_name\":\"MSG_INVITE\",\"message_action\":\"WECHAT_SNS_JUMP_URL\",\"game_data\":\"gameData\", \"weapp_id\":\"gh_e9f675597c15\"}",	
    Link = "https://www.qq.com"	
};	
MSDKFriend.SendMessage (reqInfo, "WeChat");	
	
// QQ miniApp sharing	
var reqInfo = new MSDKFriendReqInfo	
{	
    Type = FriendReqType.Friend_REQ_MINI_APP,	
    Title ="QQ miniApp sharing", 	
    Desc ="QQ miniApp Desc", 	
    // Android 	
    ThumbPath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png",	
    // iOS	
    //ImagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png",	
    Link = "http://www.qq.com";	
    ExtraJson = "{\"mini_appid\":\"1109878856\", \"mini_path\":\"pages/index/index\", \"mini_webpage_url\":\"www.qq.com\",\"mini_program_type\":3}}"	
};	
MSDKFriend.SendMessage (reqInfo, "QQ");
// WeChat miniApp sharing	
MSDKFriendReqInfo info;	
info.type = kMSDKFriendReqTypeMiniApp;	
info.extraJson = "{\"media_tag_name\":\"MSG_INVITE\",\"message_action\":\"WECHAT_SNS_JUMP_URL\",\"game_data\":\"gameData\", \"weapp_id\":\"gh_e9f675597c15\"}";	
info.link = "http://www.qq.com?gamedata=67890";		
info.thumbPath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";	
MSDKFriend::SendMessage(info, "WeChat");	
	
// QQ miniApp sharing	
MSDKFriendReqInfo reqInfo;	
reqInfo.type = kMSDKFriendReqTypeMiniApp;	
reqInfo.title ="QQ miniApp sharing"; 	
reqInfo.desc ="QQ miniApp Desc"; 	
// Android	
reqInfo.thumbPath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";	
// iOS	
// reqInfo.imagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";	
reqInfo.link = "http://www.qq.com";	
reqInfo.extraJson = "{\"mini_appid\":\"1109878856\", \"mini_path\":\"pages/index/index\", \"mini_webpage_url\":\"www.qq.com\",\"mini_program_type\":3}}";	
MSDKFriend::SendMessage(reqInfo, "QQ");

[info] Special description

WeChat miniApp sharing:

type: [required] sharing type: Friend_REQ_MINI_APP;
thumbPath: [required for Android /optional for iOS] shared miniApp icon image (when iOS sharing has no input parameters, the shared miniApp icon image is empty);
Link, required, the URL of the redirected page when miniApp is opened in the old version of WeChat (any URL can be filled in);
extraJson: extended field; miniApp's special input parameters are placed in extraJson; for details, please see MiniApp's special input parameters - WeChat miniApp's special input parameters;
MediaPath, optional, miniApp path, through which you can specify which page of miniApp to skip to (if the field is filled in with the blank string, the URL will skip to the homepage by default). For a mini-game without page, it can only pass in the ‘query’ part to achieve the parameter transmission effect, such as: pass in "?foo=bar";

Description of transmitted user-defined parameters: assembled in MediaPath for transmission,Refer to the query format of URL, the length is 100-200k. If it is too long, this can cause cross-process transmission failure; for example: MediaPath:pages/index/index?game_data={"k1":v1,"k2":"v2"}. The data received by the initiated miniApp is: game_data={\"k1\":v1,\"k2\":\"v2\"}


QQ miniApp sharing:

type: [required] sharing type: Friend_REQ_MINI_APP;
thumbPath: [optional] icon image when sharing miniApp (when there are no input parameters, the shared miniApp icon image is empty);
Link, required, compatible with lower versions of webpage link (any URL can be filled in);
extraJson: extended field; miniApp's special input parameters are placed in extraJson; for details, please see MiniApp's special input parameters - QQ miniApp's special input parameters;
Description of transmitted user-defined parameters: assembled in mini_path for transmission; Refer to the query format of url; for example: mini_path: pages/index/index?k1=v1&k2=v2, where k1=v1&k2=v2 are the user-defined transmission parameters.

5、Send music. This function supports WeChat and QQ

C#
C++
var reqInfo = new MSDKFriendReqInfo	
{	
	Type = FriendReqType.Friend_REQ_MUSIC,
	Title = "it's title",
	Desc = "it's desc",
	ImagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png",
	MediaPath = "http://music.163.com/song/media/outer/url?id=317151.mp3",
	Link = "http://y.qq.com/#type=song&mid=000cz9pr0xlAId"
};	
MSDKFriend.SendMessage (reqInfo, "WeChat");
MSDKFriendReqInfo info;	
info.type = kMSDKFriendReqTypeMusic;	
info.title = "it's title";	
info.desc = "it's desc";	
info.imagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";	
info.mediaPath = "http://music.163.com/song/media/outer/url?id=317151.mp3";	
info.link = "http://y.qq.com/#type=song&mid=000cz9pr0xlAId";	
MSDKFriend::SendMessage(info, "QQ");

[info] Special description

Title, required, the music message's title;

Desc, required, the music message's summary;

ImagePath, optional; it is required to fill in an image, whose size cannot exceed 32K;

MediaPath, required; it is required to fill in the network URL of the music data (such as http: // *.mp3); the length of the field cannot exceed 10K;

Link, required; it is required to fill in the network URL which the page will skip to after the message is clicked; the length cannot exceed 10K;


6、Send invitation. This function supports WeChat and QQ.The interface of the QQ channel does not support directed sharing of messages to friends, and the WeChat channel supports launching the chat UI of the corresponding friend

Parameter name Parameter type Parameter Description
Title int The shared message's title, required
Desc desc The shared message's content, optional
Type int Message type specified by sharing, required
User string When sopenid is used, it is required to add {\"isFriendInGame\": false} in extraJson; when gopenid is used, it is allowed to add {\"isFriendInGame\": true} in extraJson; (optional)
Link string In the QQ channel, the field is required and is filled in with the Game Center's details page
In the WeChat channel, the field is a useless field for Android and is optional for iOS; if it is left blank, a click on the message can launch the game. If the field is filled in with any other address, a click on the message will jump to the address
ThumbPath string Thumbnail; support local or network images, whose size cannot exceed 1M
ExtraJson string Extended field, which transmits the game's self-defined data; the platform will transfer the transmitted data. Among them, the user-defined transmission field 'game_data' is required for Android, and its content is not empty, and its format refers to the demo code

C#
C++
var reqInfo = new MSDKFriendReqInfo	
{	
    Type = FriendReqType.Friend_REQ_INVITE,	
    Title ="Shared message's title", 	
    Desc = "The shared message's content", 	
    // When WeChat makes directional sharing, User is a required parameter 	
    User ="gopenid or sopenid", 	
    ThumbPath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png",	
    Link = "http://gamecenter.qq.com/gcjump?appid=100703379&pf=invite&from=iphoneqq&plat=qq&originuin=111&ADTAG=gameobj.msg_invite",	
    ExtraJson = "{\"game_data\":\"gamer-defined transmitted data\", \"isFriendInGame\":false}";	
};	
MSDKFriend.SendMessage (reqInfo, "QQ");
MSDKFriendReqInfo info;	
info.type = kMSDKFriendReqTypeInvite;	
// When WeChat makes directional sharing, User is a required parameter 	
info.user ="gopenid or sopenid"; 	
info.title ="The shared message's title"; 	
info.desc ="The shared message's content"; 	
info.link = "http://gamecenter.qq.com/gcjump?appid=100703379&pf=invite&from=iphoneqq&plat=qq&originuin=111&ADTAG=gameobj.msg_invite";	
info.thumbPath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";	
info.extraJson ="{\"game_data\": \"gamer-defined transmitted data \", \"isFriendInGame\": false}"; 	
MSDKFriend::SendMessage(info, "WeChat");

Warning:

The game-defined data of QQ and WeChat can be transmitted through game_data. When the MSDK_LOGIN_WAKEUP event is triggered, it is only needed to parse the ExtraJson field in MSDKBaseRet.

7、Send invitation by the Silence mode. This function supports QQ

Parameter name Type Parameter Description
Type int Message type specified by sharing, required
User string The friend's gopenid, required
Title string Shared message's title, optional
Desc string Shared message's content, optional
Link string QQ Game Center's details page link, required
ImagePath string The shared image's URL, optional
ExtraJson string extension field, used for the transmission of game_tag field, required
game_tag string platform share-type statistics; assigned by the platform side; it is needed to communicate with QQ platform before filling in the field; required

C#
C++
var reqInfo = new MSDKFriendReqInfo	
{	
    Type = FriendReqType.Friend_REQ_INVITE_SILENT,	
    User = "The friend's gopenid",	
    Link = "QQ Game Center's details page link",	
    Title ="Shared message's title", 	
    Desc = "The shared message's content", 	
    ImagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png",	
    ExtraJson = "{\"game_tag\":\"MSG_INVITE\"}"	
};	
MSDKFriend.SendMessage (reqInfo, "QQ");
MSDKFriendReqInfo info;	
info.type = kMSDKFriendReqTypeInviteSilent;	
info.user = "8952794791840066504";	
info.title ="The shared message's title"; 	
info.desc ="The shared message's content"; 	
info.link = "QQ Game Center's details page link";	
info.imagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";
info.extraJson = "{\"game_tag\":\"MSG_INVITE\"}";	
MSDKFriend::SendMessage(info, "QQ");

  1. QQ back-end sharing; the shared structured message / ARK message can be received through C2C. In addition, you can also receive the shared message through the public account "QQ Mobile Games", but you need to pay attention to the public account in advance.
  2. The shared content can only be seen on the mobile phone QQ, but cannot be seen on PC QQ.
  3. The same pair of numbers can send and receive messages to each other, and the number of interactions is once a day.
  4. On the receiving side, the same user can receive up to 5 pieces of message per day and up to 20 pieces per week.
  5. On the sending side, the same user can send up to 10 pieces of message to different users per day and up to 40 pieces per week.

    [info] This interface does not currently support silently sharing messages to unregistered QQ friends. If you want to silently share messages to unregistered QQ friends, you need to use the server's sharing interface /v2/friend/share.

8、Launch miniApp and support WeChat and QQ (QQ has been supported since version 5.30.000)

C#
C++
// Launch WeChat miniApp
var reqInfo = new MSDKFriendReqInfo();																	
reqInfo.Type = (int)FriendReqType.FRIEND_REQ_PULL_UP_MINI_APP;																	
reqInfo.User = "gh_e9f675597c15"; // Fill in the original id of the miniApp																	
reqInfo.MediaPath = "pages/indexSelAddr/indexSelAddr";																	
reqInfo.ExtraJson = {"weapp_id":"gh_e9f675597c15","with_share_ticket":1,"mini_program_type":0};																	
MSDKFriend.SendMessage (reqInfo, "WeChat");	

// Launch QQ miniApp
var reqInfo = new MSDKFriendReqInfo();
reqInfo.Type = (int)FriendReqType.FRIEND_REQ_PULL_UP_MINI_APP;
reqInfo.ExtraJson = {\"mini_appid\":\"1109878856\", \"mini_path\":\"pages/component/pages/launchApp813/launchApp813?1=2&2=4\",\"mini_program_type\":3};
MSDKFriend.SendMessage (reqInfo, "QQ");
// Launch WeChat miniApp
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypePullUpMiniApp;																	
info.mediaPath = "pages/indexSelAddr/indexSelAddr";																	
info.extraJson = {"weapp_id":"gh_e9f675597c15","with_share_ticket":1,"mini_program_type":0};																	
MSDKFriend::SendMessage(info, "WeChat");		

// Launch QQ miniApp
MSDKFriendReqInfo info;
info.type = kMSDKFriendReqTypePullUpMiniApp;
info.extraJson = {\"mini_appid\":\"1109878856\", \"mini_path\":\"pages/component/pages/launchApp813/launchApp813?1=2&2=4\",\"mini_program_type\":3};
MSDKFriend::SendMessage(info, "QQ");

[info] Invoke the miniApp function without callback;
mediaPath (WeChat): optional, miniApp path. This field can be used to specify a page of miniApp to skip to (if you fill in an empty string in the field, the homepage will be skipped to by default). For mini-games with no pages, it is allowed to only pass in the query section to achieve parameter transfer effects, for example: pass in "?foo=bar"; extraJson: Extension field; the special input parameters of miniApp are placed in extraJson. For details, please refer to Special Input Parameters of miniApp;

9、Send ark messages. This function supports QQ

C#
C++
var reqInfo = new MSDKFriendReqInfo();																	
reqInfo.Type = (int)FriendReqType.Friend_REQ_ARK;																	
reqInfo.Title = "it's title";																	
reqInfo.Desc = "it's desc";																	
reqInfo.Link = "http://gamecenter.qq.com/gcjump?appid=100703379&pf=invite&from=iphoneqq&plat=qq&originuin=111&ADTAG=gameobj.msg_invite";																	
reqInfo.ImagePath = "http://q.qlogo.cn/qqapp/100703379/C1BF66286792F24E166C9A5D27CFB519/100";																	
reqInfo.ExtraJson = "{\"app\":\"com.tencent.gamecenter.gameshare\",\"view\":\"noDataView\",\"desc\":\"template description\",\"prompt\":\"message prompts\",\"ver\":\"0.0.0.1\",\"config\":{\"type\":\"normal\"},\"meta\":{\"shareData\":{\"appid\":\"1106977030\",\"type\":\"image\",\"url\":\"http%3a%2f%2fimgcache.qq.com%2fclub%2fmars%2fimg_upload%2fgc843_wzgame.png\",\"width\":601,\"height\":330,\"buttons\":[{\"text\":\"his or her score\",\"url\":\"http%3a%2f%2fcdn.vip.qq.com\"}]}}}";																	
MSDKFriend.SendMessage(reqInfo, "QQ");
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypeArk;																	
info.title = "it's title";																	
info.desc = "it's desc";																	
info.link = "http://gamecenter.qq.com/gcjump?appid=100703379&pf=invite&from=iphoneqq&plat=qq&originuin=111&ADTAG=gameobj.msg_invite";																	
info.imagePath = "http://q.qlogo.cn/qqapp/100703379/C1BF66286792F24E166C9A5D27CFB519/100";																	
info.extraJson = "{\"app\":\"com.tencent.gamecenter.gameshare\",\"view\":\"noDataView\",\"desc\":\"template description\",\"prompt\":\"message prompts\",\"ver\":\"0.0.0.1\",\"config\":{\"type\":\"normal\"},\"meta\":{\"shareData\":{\"appid\":\"1106977030\",\"type\":\"image\",\"url\":\"http%3a%2f%2fimgcache.qq.com%2fclub%2fmars%2fimg_upload%2fgc843_wzgame.png\",\"width\":601,\"height\":330,\"buttons\":[{\"text\":\"his or her score\",\"url\":\"http%3a%2f%2fcdn.vip.qq.com\"}]}}}";																	
MSDKFriend::SendMessage(info, "QQ");

[info] When a game developer develops ARK with QQ, it needs to consult with QQ ARK Development Team (ARK_Helper) on how to fill in the value of the extraJson field, because MSDK only transmits the field.

Note:

In order to use the ARK message delivery function normally, you as a game developer need to know the following information:

(1) In QQ client with a version earlier than 8.0.0, when ARK sharing fails, the message to be shared will be automatically converted into a structured message for sharing. The input parameters, including title, desc, url and imgUrl, are the parameters of the structured message. When ARK sharing is successful, title, desc, url and imgUrl have no use.

(2) Starting from QQ client 8.0.0, ARK parameters must be filled in correctly. If they are not filled in them, ARK-type messages can't be shared successfully. If they are filled in incorrectly, message sharing will fail.

(3) You need to register your product and make and submit your ARK card material in ARK official management system. Only after the materials of the product pass the review can the corresponding permissions be opened to it. Access to this website can only be made in the intranet. Please contact the corresponding operations personnel of Tencent to seek assistance. For details about the review and release of card templates, please consult ARK_Helper.

(4) iOS non-ARK sharing on TIM requires adding "tim" to scheme. The path is in Info.plist of iOS, Add "tim" to Information Property List-> LSApplicationQueriesSchemes. ARK client sharing requires communication with and access to the QQ Game Center. For detailed procedures, please refer to Process Description Documentation. Access to this website still can only be made in the intranet. The game's relevant operation personnel can visit the site and contact the Game Center for configuration. The Game Center's contact person is zealzhuang.

(5) ARK messages support the receiver to transmit self-defined data. For the gamedata data transmission protocol, please refer to ARK Access Documentation or contact the ARK contact person. If the gamedata data is not transmitted to the game client after the user clicks on the ARK message to invoke the game, please contact the ARK contact person to check if the platform's hoplink configuration is correct.

10、The WeChat launching function shares messages to WeChat games (in-game friends) and supports WeChat

A general function provided by WeChat. It not only can launch miniApp but may also launch a link, etc.. Games will be recommended to use this mode to launch WeChat functions later.

Field name Meaning
business_type [Required] The type of business to be opened
query [Optional] Query string, format: key1=val1&key2=val2 (usually used internally by WeChat and will be notified when needed)
ext_info [Required] User-defined ext_info information, json format. gameinfo has required fields. Please refer to the description of gameinfo below
ext_data [Only support iOS] [Optional] When the video in ext_info is a local address, it is needed to pass in the corresponding binary data path

Where the fields in ext_info include

Field Description
videoUrl video link; when neededit is 0, fill in QT video link. Getting QT video needs the help of components. When neededit is 1, fill in the downloadable video link. It is not required to be a QT video link
thumbUrl image URL
videoPath Android local video's address. Choose one betewwn videoPath and videoURL
needEdit In case of network videos, 1: enter the image and video editing page, 0: the loaded video enters the sharing page. In case of local videos, all enter the video editing page
gameInfo json format; relevant fields required by WeChat.
[Required] Where appid and appName are required fields, appid passes WeChat appid; appName means game name and can be filled with any value without restriction. For the format, please refer to: {"appid":"YOUR_WECAHT_APPID","appName":"ITOP1"}

C#
C++
var reqInfo = new MSDKFriendReqInfo();																	
reqInfo.Type = (int)FriendReqType.Friend_REQ_OPEN_BUSINESS_VIEW;																	
																	
// Network video																	
reqInfo.ExtraJson =  "{\"business_type\":\"nativeShareToGameHaoWan\", \"ext_info\":{\"videoUrl\":\"https://qt.qq.com/php_cgi/cod_video/php/get_video_url.php?vid=2a495e10fc03426fb8e4def77fc68a57&game_id=1007039\", \"thumbUrl\":\"http://shp.qpic.cn/record_smoba/0/53209e869e71dc351129059fbb5f748dT1552892652598430/\" , \"needEdit\":1, \"gameInfo\":{\"battleId\":\"game12345\",\"appid\":\"YOUR_WECAHT_APPID\",\"appName\":\"ITOP1\"}}, \"query\":\"key1=val1&key2=val2\"}";																	
																	
// Local video iOS																	
// reqInfo.ExtraJson = "{\"business_type\":\"nativeShareToGameHaoWan\",\"ext_info\":{\"thumbUrl\":\"http://shp.qpic.cn/record_smoba/0/53209e869e71dc351129059fbb5f748dT1552892652598430/\", \"needEdit\":0, \"gameInfo\":{\"battleId\":\"game12345\",\"appid\":\"YOUR_WECAHT_APPID\",\"appName\":\"ITOP1\"}}," "\"query\":\"key1=val1&key2=val2\"";																	
// reqInfo.ExtraJson +=  ", \"ext_data\": \"";																	
// reqInfo.ExtraJson += videoFilePath;																	
// reqInfo.ExtraJson += "\"}";																	
																	
// Local video Android																	
// reqInfo.ExtraJson = "{\"business_type\":\"nativeShareToGameHaoWan\", \"ext_info\":{\"videoPath\":\"/storage/emulated/0/DCIM/Camera/test.vedio.mp4\", \"needEdit\":1, \"gameInfo\":{\"battleId\":\"game12345\",\"appid\":\"YOUR_WECAHT_APPID\",\"appName\":\"ITOP1\"}}, \"query\":\"key1=val1&key2=val2\"}";																	
																	
MSDKFriend.SendMessage (reqInfo, "WeChat");
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypeOpenBusinessView;																	
																	
// Network video																	
info.extraJson =  "{\"business_type\":\"nativeShareToGameHaoWan\", \"ext_info\":{\"videoUrl\":\"https://qt.qq.com/php_cgi/cod_video/php/get_video_url.php?vid=2a495e10fc03426fb8e4def77fc68a57&game_id=1007039\", \"thumbUrl\":\"http://shp.qpic.cn/record_smoba/0/53209e869e71dc351129059fbb5f748dT1552892652598430/\" , \"needEdit\":1, \"gameInfo\":{\"battleId\":\"game12345\",\"appid\":\"YOUR_WECAHT_APPID\",\"appName\":\"ITOP1\"}}, \"query\":\"key1=val1&key2=val2\"}";																	
																	
// Local video iOS																	
// info.extraJson = "{\"business_type\":\"nativeShareToGameHaoWan\",\"ext_info\":{\"thumbUrl\":\"http://shp.qpic.cn/record_smoba/0/53209e869e71dc351129059fbb5f748dT1552892652598430/\", \"needEdit\":0, \"gameInfo\":{\"battleId\":\"game12345\",\"appid\":\"YOUR_WECAHT_APPID\",\"appName\":\"ITOP1\"}}," "\"query\":\"key1=val1&key2=val2\"";																	
// info.extraJson +=  ", \"ext_data\": \"";																	
// info.extraJson += videoFilePath;																	
// info.extraJson += "\"}";																	
																	
// Local video Android																	
// info.extraJson = "{\"business_type\":\"nativeShareToGameHaoWan\", \"ext_info\":{\"videoPath\":\"/storage/emulated/0/DCIM/Camera/test.vedio.mp4\", \"needEdit\":1, \"gameInfo\":{\"battleId\":\"game12345\",\"appid\":\"YOUR_WECAHT_APPID\",\"appName\":\"ITOP1\"}}, \"query\":\"key1=val1&key2=val2\"}";																	
																	
MSDKFriend::SendMessage(info, "WeChat");

[info] WeChat launch business function, there may be no callback; when the interface is called, the extraJson field needs to specify the business_type field (the type of business to be opened)

11、Send message to the state; support WeChat

C#
C++
var reqInfo = new MSDKFriendReqInfo () ;
reqInfo.Type =  (int) FriendReqType.Friend_REQ_WX_STATE_PHOTO;
reqInfo.Title = ""Game video"";
reqInfo.ImagePath = GetFileFromDisk (""launch_640x960.png"") ;
reqInfo.Link = ""https: //game.weixin.qq.com/cgi-bin/h5/static/circlecenter/mixed_circle.html?tabid=7&appid=wx95a3a4d7c627e07d&ssid=46#wechat_redirect"";
reqInfo.ExtraJson = ""{\""stateId\"": \""1019\""}"";
MSDKFriend.SendMessage  (reqInfo, ""WeChat"") ;
MSDKFriendReqInfo info;
info.type = kMSDKFriendReqTypeWXStatePhoto;
info.title = ""MSDK WeChat State Test Title"";
info.link = ""https: //game.weixin.qq.com/cgi-bin/h5/static/circlecenter/mixed_circle.html?tabid=7&appid=wx95a3a4d7c627e07d&ssid=46#wechat_redirect"";
info.imagePath = GetFileFromDisk (""launch_640x960.png"") ;
info.extraJson = ""{\""stateId\"": \""1019\""}"";
MSDKFriend: : SendMessage (info, ""WeChat"") ;

[info] Share the state to WeChat. After success, the state-related information will be displayed under WeChat->My Personal Avatar. Clicking on the application name under the state can make the link automatically skip to the specified page. The current version of MSDK supports sharing the image state to WeChat. If you need to access the interface, you can contact WeChat contact person: dylenyang; stateId can be filled in with 1019, link is the Game Circle's address, title is set as the default value of the edit page; after the link skips to WeChat, title and stateId parameters can be modified independently; it is suggested that the image size should be 9:16.

12、QQ Small World

MSDK encapsulates the QQ Small World Share interface and reuses the MSDKFriend.SendMessage interface, and the input parameters are MSDKFriendReqInfo info and string channel.

Please use the SendMessage interface. Type and ExtraJson in info are required fields, and other fields need not be filled in. channel should be filled in with "QQ". The info.Type parameter is set to FriendReqType.Friend_REQ_QQ_COMMON_SHARE, and info.ExtraJson is passed in by the app itself, including serviceID and extraJson fields (pay attention to case). Invocation example:

C#
C++
string serviceID = "3004"; // service ID; each connected QQ service needs to contact QQ-Connect to assign a service ID to it; Android and iOS have the same service ID
string extraJson = "{\\\"local_video_path\\\":\\\"\\\\\\/storage\\\\\\/emulated\\\\\\/0\\/Android\\\\\\/data\\\\\\/com.example.wegame\\\\\\/files\\\\\\/video.mp4\\\"}"; //Extensible parameter; the data can be transmitted to QQ, and the incoming content shall be agreed with the QQ.
var reqInfo = new MSDKFriendReqInfo
{
    Type = FriendReqType.Friend_REQ_QQ_COMMON_SHARE,
    ExtraJson = "{\"serviceID\":\"" + serviceID + "\"," + "\"extraJson\":\"" + extraJson + "\"}";
};

MSDKFriend.SendMessage (reqInfo, "QQ");
MSDKFriendReqInfo info;
info.type = kMSDKFriendReqTypeWithCommonShare;
info.extraJson = "{\"serviceID\":\"3004\",\"extraJson\":\"{\\\"local_video_path\\\":\\\"\\\\\\/storage\\\\\\/emulated\\\\\\/0\\/Android\\\\\\/data\\\\\\/com.example.wegame\\\\\\/files\\\\\\/video.mp4\\\"}\"}";
MSDKFriend::SendMessage(info, "QQ");

Warning

  • To assign service ID, please contact QQ contact persons:gavinyao、chuanyouxie

14、WeChat native sharing

MSDK encapsulates the WeChat native sharing type. APP can share messages to WeChat friends by reusing MSDKFriend.SendMessage interface. The input parameters are MSDKFriendReqInfo info and string channel.

Please use the SendMessage interface. channel should be fixed as "WeChat"; info.Type parameter is set as FriendReqType.Friend_REQ_WX_NATIVE_GAME_PAGE; info.ExtraJson is passed in by APP itself and transmits isVideo, videoDuration, shareData and other parameters. For details, please refer to WeChat native sharing interface documentation: https://iwiki.woa.com/pages/viewpage.action?pageId=4007456114.Invocation example:

C#
C++
var reqInfo = new MSDKFriendReqInfo();
reqInfo.Type = (int)FriendReqType.Friend_REQ_WX_NATIVE_GAME_PAGE;
reqInfo.Title = "WeChat native page sharing";  // Title
reqInfo.Desc = "WeChat sharing experience optimization"; // Summary information
reqInfo.ThumbPath = GetFileFromDisk ("test4.jpg");  // Fill in the corresponding cover image path
reqInfo.ExtraJson = "{\"message_action\":\"\",\"game_data\":\"Game Data\",\"media_tag_name\":\"MSG_INVITE\",\"isVideo\":0,\"videoDuration\":0,\"shareData\":\"{\\\"appid\\\":\\\"wx95a3a4d7c627e07d\\\",\\\"floating_layer\\\":{\\\"floating_layer_id\\\":23},\\\"game_launch\\\":{\\\"message_ext\\\":\\\"xxxx\\\"},\\\"share_image_tpl\\\":{\\\"share_img_list\\\":[{\\\"img_url\\\":\\\"http://p.qpic.cn/wxapp/98Nz5LFElxwa1SvRtFFOIV046OU5pA2PWicuC3rDosgy6D1wb9oAGRAYnYfVh6gNOyKzzEc1LiboQ/c456\\\",\\\"width\\\":300,\\\"height\\\":300}],\\\"user_card\\\":{\\\"content\\\":\\\"What kind of bird is this? It's so lovely and cute. I fall in love with it at a glance. The park is a magical place. Display up to two lines of words. When the word count is too long, excessive words will be automatically omitted...\\\"}}}\"}"; // Transmission parameter

MSDKFriend.SendMessage (reqInfo, "WeChat");
MSDKFriendReqInfo info;

info.type = kMSDKFriendReqTypeWXNativeGamePage;
info.title = "WeChat native page sharing";  // Title
info.desc = "WeChat sharing experience optimization"; // Summary information
info.thumbPath = GetFileFromDisk ("test4.jpg");   // Fill in the corresponding cover image path
info.extraJson = "{\"message_action\":\"\",\"game_data\":\"Game Data\",\"media_tag_name\":\"MSG_INVITE\",\"isVideo\":0,\"videoDuration\":0,\"shareData\":\"{\\\"appid\\\":\\\"wx95a3a4d7c627e07d\\\",\\\"floating_layer\\\":{\\\"floating_layer_id\\\":23},\\\"game_launch\\\":{\\\"message_ext\\\":\\\"xxxx\\\"},\\\"share_image_tpl\\\":{\\\"share_img_list\\\":[{\\\"img_url\\\":\\\"http://p.qpic.cn/wxapp/98Nz5LFElxwa1SvRtFFOIV046OU5pA2PWicuC3rDosgy6D1wb9oAGRAYnYfVh6gNOyKzzEc1LiboQ/c456\\\",\\\"width\\\":300,\\\"height\\\":300}],\\\"user_card\\\":{\\\"content\\\":\\\"What kind of bird is this? It's so lovely and cute. I fall in love with it at a glance. The park is a magical place. Display up to two lines of words. When the word count is too long, excessive words will be automatically omitted...\\\"}}}\"}";  // Transmission parameter

MSDKFriend::SendMessage(info, "WeChat");

2.3 Share information

1) Functional description

Send messages to the information wall, such as WeChat Moment, QZone and Facebook. The information is basically visible to all friends. In case of login, the channel's input parameter can be left blank.

2) Interface declaration

C#
C++
public static void Share(MSDKFriendReqInfo info, string channel = "")
public static void Share(const MSDKFriendReqInfo &reqInfo, const string &channel = "");

3) Description of input parameters

Parameter name Parameter type Description
info MSDKFriendReqInfo The Friend module's request struct, which mainly contains important input parameters such as the request object and request information
channel string Channel information, such as "WeChat", "QQ", "Facebook"

4) Demo code

  1. Share text. This function supports WeChat Moment, QZone, Twitter (Only for Android platform) and System

    C#
    C++
    var reqInfo = new MSDKFriendReqInfo																	
    {																	
    	Type = FriendReqType.Friend_REQ_TEXT,																
    	Desc = "MSDK is a platform for the Value Added Service Department of Interactive Entertainment Business Group to provide public components and service libraries for games"																
    };																	
    MSDKFriend.Share (reqInfo, "QQ");
    MSDKFriendReqInfo info;																	
    info.type = kMSDKFriendReqTypeText;																	
    info.desc = "MSDK is a platform for the Value Added Service Department of Interactive Entertainment Business Group to provide public components and service libraries for games";																	
    MSDKFriend::Share(info, "WeChat");

  2. Share links. This function supports WeChat Moment, QZone, Facebook, Twitter (Only for Android platform) and System (iOS platform)

    C#
    C++
    var reqInfo = new MSDKFriendReqInfo																	
    {																	
    	Type = FriendReqType.Friend_REQ_LINK,																
    	Link = "https://www.qq.com"																
    };																	
    MSDKFriend.Share (reqInfo, "Facebook");
    MSDKFriendReqInfo info;																	
    info.type = kMSDKFriendReqTypeLink;																	
    info.link = "https://www.qq.com";																	
    MSDKFriend::Share(info, "WeChat");

  3. Share images. This function supports WeChat Moment, QZone, Facebook, Twitter (Only for Android platform) and System

    C#
    C++
    var reqInfo = new MSDKFriendReqInfo																	
    {																	
    	Type = FriendReqType.Friend_REQ_IMG,																
    	ImagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";																
    };																	
    MSDKFriend.Share (reqInfo, "Facebook");
    MSDKFriendReqInfo info;																	
    info.type = kMSDKFriendReqTypeIMG;																	
    info.imagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";																	
    MSDKFriend::Share(info, "WeChat");

  4. Share music. This function supports WeChat Moment

    C#
    C++
    var reqInfo = new MSDKFriendReqInfo																	
    {																	
    	Type = FriendReqType.Friend_REQ_MUSIC,																
    	Link = "http://i.y.qq.com/rsc/fcgi-bin/fcg_pyq_play.fcg?songid=&songmid=003vUjJp3QwFcd&songtype=1&fromtag=46&uin=496387275&code=C9E8C",																
    	ImagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png"																
    };																	
    MSDKFriend.Share (reqInfo, "WeChat");
    MSDKFriendReqInfo info;																	
    info.type = kMSDKFriendReqTypeMusic;																	
    info.link = "http://y.qq.com/#type=song&mid=000cz9pr0xlAId";																	
    info.imagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";																	
    MSDKFriend::Share(info, "WeChat");

  5. Share invitation. This function supports QZone and supports QZone's new capability. For details, please refer to Description and examples of QZone's new capability

    C#
    C++
    var reqInfo = new MSDKFriendReqInfo																	
    {																	
    	Type = FriendReqType.Friend_REQ_INVITE,																
    	Link = "http://m.gamecenter.qq.com/directout/detail/1106977030?_wv=2147484679&_wwv=4&ADTAG=gamecenter&autodownload=1&pf=invite&appid=1106977030&asyncMode=3&appType=1&_nav_bgclr=ffffff&_nav_titleclr=ffffff&_nav_txtclr=ffffff&_nav_anim=true&_nav_alpha=0";																
    };																	
    MSDKFriend.Share (reqInfo, "QQ");
    MSDKFriendReqInfo info;																	
    info.type = kMSDKFriendReqTypeInvite;																	
    info.link = "http://m.gamecenter.qq.com/directout/detail/1106977030?_wv=2147484679&_wwv=4&ADTAG=gamecenter&autodownload=1&pf=invite&appid=1106977030&asyncMode=3&appType=1&_nav_bgclr=ffffff&_nav_titleclr=ffffff&_nav_txtclr=ffffff&_nav_anim=true&_nav_alpha=0";																	
    MSDKFriend::Share(info, "QQ");

  6. Share videos. This function supports QZone, Facebook, Kwai

C#
C++
var reqInfo = new MSDKFriendReqInfo																	
{																	
    Type = FriendReqType.Friend_REQ_VIDEO,																	
    MediaPath = "address of local video"																	
};																	
MSDKFriend.Share (reqInfo, "QQ");
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypeVideo;																	
info.mediaPath = "assets-library://asset/asset.MOV?id=076D059F-C610-4DA5-8593-52EABD26F944&ext=MOV";																	
MSDKFriend::Share(info, "Facebook");

[info] Video sharing only supports the sharing of local videos. Facebook iOS's video sharing is recommended to use asset url for video sharing;
As for notices about QQ video sharing, please refer to QQ function description.
As for Kwai video sharing, please refer to Kwai's friend function description.

7.Share messages in WeChat Game Circle. This function only supports the sharing of images (including local images and network images)

C#
C++
var reqInfo = new MSDKFriendReqInfo																	
{																	
	Type = FriendReqType.Friend_REQ_WX_GAMELINE,																
	ImagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";																
	ExtraJson = "{\"gameextra\":\"shareWXGameLinePic\"}";																
};																	
MSDKFriend.Share (reqInfo, "WeChat");
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypeWXGameLine;																	
info.imagePath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";																	
info.extraJson = "{\"gameextra\":\"shareWXGameLinePic\"}";																	
MSDKFriend::Share(info, "WeChat");

[info]

  1. The size of the image data cannot exceed 512K. For any image exceeding this size, the game needs to compress and process it by itself.
  2. gameextra field in extraJson: the game's self-defined parameter, which is appended to the end of URL of the sharing page. It is recommended that the game pass the parameter after processing it with Base64 encoding. This parameter of MSDK is only transmitted without any processing. At the same time, it is necessary to ensure that the length of this parameter meets the URL length requirement.

8.Share miniApp to QZone

C#
C++
var reqInfo = new MSDKFriendReqInfo	
{	
	Type = FriendReqType.Friend_REQ_MINI_APP,
	Title ="QQ miniApp sharing", 
	Desc ="QQ miniApp Desc", 
	ThumbPath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png",
	ExtraJson = "{\"mini_appid\":\"1109878856\", \"mini_path\":\"pages/index/index\", \"mini_webpage_url\":\"www.qq.com\",\"mini_program_type\":3}}"
};	
MSDKFriend.Share (reqInfo, "QQ");
MSDKFriendReqInfo info;	
info.type = kMSDKFriendReqTypeMiniApp;
info.title ="QQ miniApp sharing"; 	
info.desc ="QQ miniApp Desc"; 	
info.thumbPath = "http://mat1.gtimg.com/www/qq2018/imgs/qq_logo_2018x2.png";	
info.link = "http://www.qq.com";	
info.extraJson = "{\"mini_appid\":\"1109878856\", \"mini_path\":\"pages/index/index\", \"mini_webpage_url\":\"www.qq.com\",\"mini_program_type\":3}}";	
MSDKFriend::Share(info, "QQ");

[info] Special description
Title, optional, the shared message's title;

Desc, required, the shared message's summary description; if the field is left blank, some models may show a parameter error;

ThumbPath, optional, the icon image of the shared miniApp;

Link, required, compatible with lower versions of webpage link (any URL can be filled in);

ExtraJson, required, miniApp parameter's special input parameter; mini_appid in the field is required, where the value of ‘key’ is fixed and the value of ‘value’ needs to be assembled according to the business. Please refer to MiniApp special input parameter-QQ miniApp special input parameter;

Description of transmitted user-defined parameters: transmitted through mini_path in ExtraJson;

9.Share message to Video Channel; support WeChat Video Channel

C#
C++
var reqInfo = new MSDKFriendReqInfo
{
    Type = FriendReqType.Friend_REQ_WX_CHANNEL_SHARE_VIDEO;
    //Android MediaPath transmits the local path of the video
    MediaPath = GetFileFromDisk  ("test_video.mp4") ;
    //iOS MediaPath transmits the album "Local Identify" of the video
    MediaPath = GetVideoLocalIdentify () ;
};
MSDKFriend.Share  (reqInfo, "WeChat") ;
MSDKFriendReqInfo info;
info.type = kMSDKFriendReqTypeWXChannelShareVideo;
//Android MediaPath transmits the local path of the video
info.mediaPath = getImagePathByDefaultSetting ("test_video.mp4") ;
//iOS MediaPath transmits the album "Local Identify" of the video
info.MediaPath = GetVideoLocalIdentify () ;
MSDKFriend: : Share (info, "WeChat") ;

10.Share message to the state; support WeChat

C#
C++
var reqInfo = new MSDKFriendReqInfo
{
    Type = FriendReqType.Friend_REQ_WX_STATE_PHOTO;
    Title = "Game video ";
    ImagePath = GetFileFromDisk ("launch_640x960.png") ;
    Link = "https: //game.weixin.qq.com/cgi-bin/h5/static/circlecenter/mixed_circle.html?tabid=7&appid=wx95a3a4d7c627e07d&ssid=46#wechat_redirect";
    ExtraJson = "{\"stateId\": \"1019\"}";
};
MSDKFriend.Share  (reqInfo, "WeChat") ;
MSDKFriendReqInfo info;
info.type = kMSDKFriendReqTypeWXStatePhoto;
info.title = "MSDK WeChat State Test Title";
info.link = "https: //game.weixin.qq.com/cgi-bin/h5/static/circlecenter/mixed_circle.html?tabid=7&appid=wx95a3a4d7c627e07d&ssid=46#wechat_redirect";
info.imagePath = GetFileFromDisk ("launch_640x960.png") ;
info.extraJson = "{\"stateId\": \"1019\"}";
MSDKFriend: : Share (info, "WeChat") ;

[info] Share the state to WeChat. After success, the state-related information will be displayed under WeChat->My Personal Avatar. Clicking on the application name under the state can make the link automatically skip to the specified page. The current version of MSDK supports sharing the image state to WeChat. If you need to access the interface, you can contact WeChat contact person: dylenyang; stateId can be filled in with 1019, link is the Game Circle's address, title is set as the default value of the edit page; after the link skips to WeChat, title and stateId parameters can be modified independently; it is suggested that the image size should be 9:16.

11.Android Instagram Channel sharing

Support sharing texts and images. Since the sharing process of iOS Instagram is similar to system sharing, you cannot select Instagram separately. iOS is not integrated yet, so it is recommended to use system sharing directly.

// Share text messages
public static final String mCurChannel = "Instagram";//Define `Channel` as Instagram
MSDKFriendReqInfo reqInfo = new MSDKFriendReqInfo();
reqInfo.desc = "MSDK text sharing test";
reqInfo.type = MSDKFriendReqInfo.FRIEND_REQ_TEXT;
MSDKPlatform.Friend.share(reqInfo, mCurChannel);

Based on system sharing, Instagram sharing supports the sharing of local images or network images and shares them internally through FileProvider. For network images, MSDK needs to download them locally before sharing them.

// Share image information
public static final String mCurChannel = "Instagram";//Define `Channel` as Instagram
MSDKFriendReqInfo reqInfo = new MSDKFriendReqInfo();
reqInfo.type = MSDKFriendReqInfo.Friend_REQ_IMG;
reqInfo.title = "it's title";
reqInfo.link = "http://gamecenter.qq.com/gcjump?appid=100703379&pf=invite&from=iphoneqq&plat=qq&originuin=111&ADTAG=gameobj.msg_invite";
reqInfo.imagePath = "http://q.qlogo.cn/qqapp/100703379/C1BF66286792F24E166C9A5D27CFB519/100";
MSDKPlatform.Friend.share(reqInfo, mCurChannel);

[info] The package visibility of Android Target 30 for Instagram sharing

  1. Android Instagram sharing is actually accomplished through system sharing. If Instagram is not installed on the mobile phone, an empty application list will pop up in the system sharing pop-up window. This actually shows that sharing fails, so it is needed to check whether Instagram has been installed in advance.
  2. In order to adapt to a more comprehensive scene, MSDK's Instagram sharing does not check the installation package by default. If the app needs to do so, please add query in the installation package of Target 30, as shown in the following. At the same time, add the following configure option in MSDKConfig.ini: ENABLE_PACKAGE_CHECK, whose value is 1.
<queries>
    ...
    <package android:name="com.instagram.android" />
</queries>

12.WeChat native sharing

MSDK encapsulates the WeChat native sharing type. APP can share messages to WeChat friends by reusing MSDKFriend.Share interface. The input parameters are MSDKFriendReqInfo info and string channel.

Please use the Share interface. channel should be fixed as "WeChat"; info.Type parameter is set as FriendReqType.Friend_REQ_WX_NATIVE_GAME_PAGE; info.ExtraJson is passed in by APP itself and transmits isVideo, videoDuration, shareData and other parameters. For details, please refer to WeChat native sharing interface documentation: https://iwiki.woa.com/pages/viewpage.action?pageId=4007456114.Invocation example:

C#
C++
var reqInfo = new MSDKFriendReqInfo();
reqInfo.Type = (int)FriendReqType.Friend_REQ_WX_NATIVE_GAME_PAGE;
reqInfo.Title = "WeChat native page sharing";  // Title
reqInfo.Desc = "WeChat sharing experience optimization"; // Summary information
reqInfo.ThumbPath = GetFileFromDisk ("test4.jpg");  // Fill in the corresponding cover image path
reqInfo.ExtraJson = "{\"message_action\":\"\",\"game_data\":\"Game Data\",\"media_tag_name\":\"MSG_INVITE\",\"isVideo\":0,\"videoDuration\":0,\"shareData\":\"{\\\"appid\\\":\\\"wx95a3a4d7c627e07d\\\",\\\"floating_layer\\\":{\\\"floating_layer_id\\\":23},\\\"game_launch\\\":{\\\"message_ext\\\":\\\"xxxx\\\"},\\\"share_image_tpl\\\":{\\\"share_img_list\\\":[{\\\"img_url\\\":\\\"http://p.qpic.cn/wxapp/98Nz5LFElxwa1SvRtFFOIV046OU5pA2PWicuC3rDosgy6D1wb9oAGRAYnYfVh6gNOyKzzEc1LiboQ/c456\\\",\\\"width\\\":300,\\\"height\\\":300}],\\\"user_card\\\":{\\\"content\\\":\\\"What kind of bird is this? It's so lovely and cute. I fall in love with it at a glance. The park is a magical place. Display up to two lines of words. When the word count is too long, excessive words will be automatically omitted...\\\"}}}\"}"; // Transmission parameter

MSDKFriend.Share (reqInfo, "WeChat");
MSDKFriendReqInfo info;

info.type = kMSDKFriendReqTypeWXNativeGamePage;
info.title = "WeChat native page sharing";  // Title
info.desc = "WeChat sharing experience optimization"; // Summary information
info.thumbPath = GetFileFromDisk ("test4.jpg");   // Fill in the corresponding cover image path
info.extraJson = "{\"message_action\":\"\",\"game_data\":\"Game Data\",\"media_tag_name\":\"MSG_INVITE\",\"isVideo\":0,\"videoDuration\":0,\"shareData\":\"{\\\"appid\\\":\\\"wx95a3a4d7c627e07d\\\",\\\"floating_layer\\\":{\\\"floating_layer_id\\\":23},\\\"game_launch\\\":{\\\"message_ext\\\":\\\"xxxx\\\"},\\\"share_image_tpl\\\":{\\\"share_img_list\\\":[{\\\"img_url\\\":\\\"http://p.qpic.cn/wxapp/98Nz5LFElxwa1SvRtFFOIV046OU5pA2PWicuC3rDosgy6D1wb9oAGRAYnYfVh6gNOyKzzEc1LiboQ/c456\\\",\\\"width\\\":300,\\\"height\\\":300}],\\\"user_card\\\":{\\\"content\\\":\\\"What kind of bird is this? It's so lovely and cute. I fall in love with it at a glance. The park is a magical place. Display up to two lines of words. When the word count is too long, excessive words will be automatically omitted...\\\"}}}\"}";  // Transmission parameter

MSDKFriend::Share(info, "WeChat");

III. FAQ

3.1 Details about MSDKFriendReqInfo

Member variable name Type Description
Type int Required when sharing a message, but not required when adding friends. [Friend request type] (#33- Detailed description of friends request types). The backend sends messages by the Silence mode or by launching the app
User string The user, which can be id or openid. For example, when a player specifies a friend for sharing messages in WeChat, it is needed to fill in the openid of the specified friend
Title string Required; the title of the shared content
Desc string Optional; overview, which briefly describes the purpose of sharing
ImagePath string Optional; the image path, which can be a local address or URL. It is recommended to use the local address
ThumbPath string Optional; thumbnail, which is generally the game's icon and can be a local icon or an icon URL. It is recommended to use a local address. WeChat sharing supports up to 64k
MediaPath string Optional; multimedia (music or video), which only supports the local address
Link string Optional; the link of the sent/shared image, music, video or invitation, etc.
1、When sending invitation:
(1) In the QQ channel, the field is required and is filled in with the Game Center's details page
(2) In the WeChat channel, the field is a useless field for Android and is optional for iOS; if it is left blank, a click on the message can launch the game. If the field is filled in with any other address, a click on the message will jump to the address
ExtraJson string Optional, extension field; When sending invitation, for Android, the field is required, and its content can be empty

3.2 Details about MSDKPersonInfo

Member variable name Type Description
openid string User ID
userName string Nickname
gender int Gender, undefined-0, male-1, female-2
WeChat and QQ channels always return 0
pictureUrl string Avatar link
country string country
province string province
city string city
language string language

3.3 Detailed description of friends request types

C#
C++
public enum FriendReqType																	
{																	
    Friend_REQ_TEXT = 10000,           //text sharing																	
    Friend_REQ_LINK,                   // link sharing																	
    Friend_REQ_IMG,                    //image sharing																	
    Friend_REQ_INVITE,                 //app invitation																	
    Friend_REQ_MUSIC,                  //Music sharing																	
    Friend_REQ_VIDEO,                  // video sharing																	
    Friend_REQ_MINI_APP,               //MiniApp sharing 																	
    FRIEND_REQ_PULL_UP_MINI_APP,       //MiniApp launch 																	
    Friend_REQ_ARK,                    //ARKsharing
    FRIEND_REQ_OPEN_BUSINESS_VIEW,	   //The app's function is invoked															
    Friend_REQ_WX_GAMELINE,            // WeChat Game Circle image sharing
    FRIEND_REQ_WX_CHANNEL_SHARE_VIDEO,      //Share the message to the video channel
    FRIEND_REQ_WX_CHANNEL_START_LIVE,       //Video channel livestreaming
    FRIEND_REQ_QQ_COMMON_SHARE,             //QQ universal sharing, which currently supports Small World		
    FRIEND_REQ_WX_NATIVE_GAME_PAGE,         //WeChat native sharing															
																	
    Friend_REQ_TEXT_SILENT = 20000,     //text sharing ( Silence ) 																	
    Friend_REQ_LINK_SILENT,             // link sharing  ( Silence ) 																	
    Friend_REQ_IMG_SILENT,              //image sharing  (Silence) 																	
    Friend_REQ_INVITE_SILENT,           //app invitation (Silence) 																	
    Friend_REQ_MUSIC_SILENT,            //Music sharing  (Silence) 																	
    Friend_REQ_VIDEO_SILENT,            // video sharing (Silence) 																	
    Friend_REQ_MINI_APP_SILENT,          //MiniApp sharing  (Silence) 																	
}
typedef enum MSDKFriendReqType																	
{																	
    kMSDKFriendReqTypeText = 10000,           //text sharing																	
    kMSDKFriendReqTypeLink,                   //link sharing																	
    kMSDKFriendReqTypeIMG,                    //image sharing																	
    kMSDKFriendReqTypeInvite,                 //app invitation																	
    kMSDKFriendReqTypeMusic,                  //Music sharing																	
    kMSDKFriendReqTypeVideo,                  // video sharing																	
    kMSDKFriendReqTypeMiniApp,                //MiniApp sharing 																	
    kMSDKFriendReqTypePullUpMiniApp,          //MiniApp launch 																	
    kMSDKFriendReqTypeArk,                    //ARKsharing
    kMSDKFriendReqTypeOpenBusinessView,       //The app's function is invoked																	
    kMSDKFriendReqTypeWXGameLine,             //WeChat Game Circle image sharing
    kMSDKFriendReqTypeWXChannelShareVideo,    //Share the message to the video channel
    kMSDKFriendReqTypeWXChannelStartLive,     //Video channel livestreaming
    kMSDKFriendReqTypeWithCommonShare,        //QQ universal sharing, which currently supports Small World					
    kMSDKFriendReqTypeWXNativeGamePage,       //WeChat native sharing												
																	
    kMSDKFriendReqTypeTextSilent = 20000,     //text sharing ( Silence ) 																	
    kMSDKFriendReqTypeLinkSilent,             //link sharing (Silence)																	
    kMSDKFriendReqTypeIMGSilent,              //image sharing  (Silence) 																	
    kMSDKFriendReqTypeInviteSilent,           //app invitation (Silence) 																	
    kMSDKFriendReqTypeMusicSilent,            //Music sharing  (Silence) 																	
    kMSDKFriendReqTypeVideoSilent,            // video sharing (Silence) 																	
    kMSDKFriendReqTypeMiniAppSilent,          //MiniApp sharing  (Silence) 																	
} MSDKFriendReqType;

3.4 Special input parameters of miniApp

Wechat miniApp special parameters

extraJson = "{\"media_tag_name\":\"MSG_INVITE\",                                                                    
\"message_ext\":\"messageExt\",                                                                    
\"weapp_id\":\"gh_e9f675597c15\",                                                                    
\"mini_program_type\":\"0\"}";
Parameter name Description
media_tag_name 【Optional】; this value will be passed to WeChat for statistics. Details click here
message_ext 【Optional】; the user-defined value passed in when the game shares messages. The game will be launched with this message. The value of the parameter will be passed back to the game through the extension field in the app wakeup callback, that is, the parameter is transparently transmitted; if not needed, you can fill an empty string into it. A filling example is as follows: \"message_ext\":{\"loobyid\":\"123456\",\"roomid\":\"123456\"} or \"message_ext\":\"messageExt\
weapp_id 【Required】; miniApp id, such as gh_e9f675597c15
mini_program_type 【Optional】; specify the miniApp version, which is divided into three types of versions: Release (0), Test (1) and Preview (2), corresponding to the miniApp version

QQ miniApp special parameters

extraJson = "{\"mini_appid\":\"1109878856\",
\"mini_path\":\"pages/index/index\",
\"mini_webpage_url\":\"http://www.qq.com\",
\"mini_program_type\":3}";
Parameter name Description
mini_appid 【Required】; the AppId of miniApp (Note: The miniApp must be bound to the shared App in the QQ interconnection platform)
mini_path 【Optional】; the display path of miniApp; the homepage of miniApp will be woken up by default if the field is not filled in; It can carry parameters; for example: pages/main/index?a=123&b=123
mini_webpage_url Be compatible with lower versions of webpage link; MSDK can automatically assign the link's value to mini_webpage_url (when shared to QZone, the link's value will be assigned to the targetURL); the game does not need to pass in the parameter in extraJson; optional
mini_program_type 【Optional】; the type of miniApp, defaulted as official version (3), optional test version (1) and development version (0)

3.5 Description and examples of QZone's new capability

QZone's new capability (which has a small tail and supports to configure hot zones, webview popups and trajectory gestures) is provided by the platform. Its specific functions are decided by the game side and the platform through communication and are configured on the platform side. The shared video and the hoplink are generated by the game side according to the access documentation provided by the platform , and reused in the interface through which MSDK shares invitation messages to QZone.

Introduction of QZone's new sharing capability (provided by the platform):

  • Internal access: [http: //km.oa.com/group/mobileqqgamecenter/articles/show/382797] (http: //km.oa.com/group/mobileqqgamecenter/articles/show/382797)
  • External access (based on km documentation): https://docs.qq.com/doc/DY2lhTHRld05aaU12

Access documentation of QZone's new sharing capability (provided by the platform):

It is needed to communicate with the platform to access QZone's new sharing capability. Contact person: tyronehuang

[info] The share icon is configured on the platform in a unified way, without passing parameters through MSDK's interfaces

QZone's new capability - Share images to QZone

The demo code is as follows:

C#
C++
var reqInfo = new MSDKFriendReqInfo																	
{																	
	Type = FriendReqType.Friend_REQ_INVITE,																
	Title = "At the moment the giant dragon opens his eyes, his adrenaline spikes!",																
	Desc = "The one-minute video of 'Dragon Fantasy' reveals the history of the rise and fall of the dragon family!",																
	Link = "http://m.gamecenter.qq.com/directout/detail/1106977030?_wv=2147484679&_wwv=4&ADTAG=gamecenter&autodownload=1&pf=invite&appid=1106977030&asyncMode=3&appType=1&_nav_bgclr=ffffff&_nav_titleclr=ffffff&_nav_txtclr=ffffff&_nav_anim=true&_nav_alpha=0",																
	//  In MSDK 5.9 and earlier versions, Android transmits images through the ImagePath field															
	// ImagePath = "http://a4.qpic.cn/psb?/V13unC2l0XwD6y/tWdnyrIa5eIJUdqcPfUz63QuKIUDJpNpt3yBiqE02qQ!/b/dL8AAAAAAAAA&ek=1&kp=1&pt=0&bo=3AVMA9wFTAMRECc!&tl=1&vuin=3052014295&tm=1567681200&sce=60-2-2&rf=viewer_311"																
	// In MSDK 5.10 and later versions, the server and client both transmit images through ThumbPath															
	ThumbPath = "http://a4.qpic.cn/psb?/V13unC2l0XwD6y/tWdnyrIa5eIJUdqcPfUz63QuKIUDJpNpt3yBiqE02qQ!/b/dL8AAAAAAAAA&ek=1&kp=1&pt=0&bo=3AVMA9wFTAMRECc!&tl=1&vuin=3052014295&tm=1567681200&sce=60-2-2&rf=viewer_311"																
};																	
MSDKFriend.Share (reqInfo, "QQ");
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypeInvite;																	
info.title = "At the moment the giant dragon opens his eyes, his adrenaline spikes!",																	
info.desc = "The one-minute video of 'Dragon Fantasy' reveals the history of the rise and fall of the dragon family!",																	
info.link = "http://m.gamecenter.qq.com/directout/detail/1106977030?_wv=2147484679&_wwv=4&ADTAG=gamecenter&autodownload=1&pf=invite&appid=1106977030&asyncMode=3&appType=1&_nav_bgclr=ffffff&_nav_titleclr=ffffff&_nav_txtclr=ffffff&_nav_anim=true&_nav_alpha=0";																	
// In MSDK 5.9 and earlier versions, Android transmits images through the ImagePath field																
// info.imagePath = "http://a4.qpic.cn/psb?/V13unC2l0XwD6y/tWdnyrIa5eIJUdqcPfUz63QuKIUDJpNpt3yBiqE02qQ!/b/dL8AAAAAAAAA&ek=1&kp=1&pt=0&bo=3AVMA9wFTAMRECc!&tl=1&vuin=3052014295&tm=1567681200&sce=60-2-2&rf=viewer_311";																	
// In MSDK 5.10 and later versions, the server and client both transmit images through ThumbPath																
info.thumbPath = "http://a4.qpic.cn/psb?/V13unC2l0XwD6y/tWdnyrIa5eIJUdqcPfUz63QuKIUDJpNpt3yBiqE02qQ!/b/dL8AAAAAAAAA&ek=1&kp=1&pt=0&bo=3AVMA9wFTAMRECc!&tl=1&vuin=3052014295&tm=1567681200&sce=60-2-2&rf=viewer_311";																	
MSDKFriend::Share(info, "QQ");

[info] 'link' transfers the hoplink; MSDK 5.9 and earlier versions transmit the shared images through the field imagePath (Android) / thumbPath (iOS) ; in MSDK 5.10 and later versions, the server and client both transmit the shared images through the field thumbPath; support local images; The image size does not exceed 1M.

The sharing effect is shown in the following picture:

The new capability shares images to QZone

QZone's new capability - Share videos to QZone

The demo code is as follows:

C#
C++
var reqInfo = new MSDKFriendReqInfo																	
{																	
	Type = FriendReqType.Friend_REQ_INVITE,																
	Title = "At the moment the giant dragon opens his eyes, his adrenaline spikes!",																
	Desc = "The one-minute video of 'Dragon Fantasy' reveals the history of the rise and fall of the dragon family!",																
	// In MSDK 5.9 and earlier versions, Android transmits images through the ImagePath field																	
	// ImagePath = "https://game.gtimg.cn/images/xiawa/cp/D181226/images/96.png",																
	// In MSDK 5.10 and later versions, the server and client both transmit images through ThumbPath															
	ThumbPath = "https://game.gtimg.cn/images/xiawa/cp/D181226/images/96.png",																
	Link = "https://v.qq.com/x/page/e08824fm35c.html?_sharetype=1&_shareid=12345&_appid=1106396765"																
};																	
MSDKFriend.Share (reqInfo, "QQ");
MSDKFriendReqInfo info;																	
info.type = kMSDKFriendReqTypeInvite;																	
info.title = "At the moment the giant dragon opens his eyes, his adrenaline spikes!",																	
info.desc = "The one-minute video of 'Dragon Fantasy' reveals the history of the rise and fall of the dragon family!",																	
// In MSDK 5.9 and earlier versions, Android transmits images through the ImagePath field																		
// info.imagePath = "https://game.gtimg.cn/images/xiawa/cp/D181226/images/96.png";																	
// In MSDK 5.10 and later versions, the server and client both transmit images through ThumbPath																
info.thumbPath = "https://game.gtimg.cn/images/xiawa/cp/D181226/images/96.png";																	
info.link = "https://v.qq.com/x/page/e08824fm35c.html?_sharetype=1&_shareid=12345&_appid=1106396765";																	
MSDKFriend::Share(info, "QQ");

[info] 'link' transfers the video link.MSDK 5.9 and earlier versions transmit the shared images through the field imagePath (Android) / thumbPath (iOS) ; in MSDK 5.10 and later versions, the server and client both transmit the shared images through the field thumbPath; support local images

The sharing effect is shown in the following picture:

The new capability shares videos to QZone

3.6 Error code

Refer to Error Code Description.



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""