Share
Unity3D
Outline
Access Guide
Structured share
Big image share
Music share
Back-end share
WeChat link share
Mobile QQ rich share
Mobile QQ video share
ark share
Mobile QQ game center's details page
Backend sharing to group
Share messages to WeChat GameLine
WeChat DeepLink
MiniApp share
Start miniApp
Share the pure text to QZone
Share status messages to WeChat status
Share videos to WeChat video account
WeChat Video Channel livestreaming
QQ Small World Share
WeChat Native Sharing
Android
Outline
Access Guide
Structured share
Big image share
Music share
Back-end share
WeChat link share
Mobile QQ rich share
Mobile QQ video share
ark share
Mobile QQ game center's details page
Backend sharing to group
Share messages to WeChat GameLine
WeChat DeepLink
MiniApp share
Start miniApp
Share the pure text to QZone
Share status messages to WeChat status
Share videos to WeChat video account
WeChat Video Channel livestreaming
QQ Small World Share
WeChat Native Sharing
IOS
Outline
Access Guide
Structured share
Big image share
Music share
Back-end share
WeChat link share
Mobile QQ rich share
Mobile QQ video share
ark share
Mobile QQ game center's details page
Backend sharing to group
Share messages to WeChat GameLine
WeChat DeepLink
MiniApp share
Start miniApp
Share the pure text to QZone
Share status messages to WeChat status
Share videos to WeChat video account
WeChat Video Channel livestreaming
QQ Small World Share
WeChat Native Sharing
Others
Data Structure
System Tools
Share / IOS / Outline

Outline

The share module provides the ability for the game to share personalized messages to mobile QQ/WeChat sessions (including friends and groups), QZone, WeChat Moments. It is commonly used in invitation, show-off, heart sending, activity sharing and so on. By relying on Tencent relation chain, MSDK's share module gives full play to the advantage of mobile QQ and WeChat relation chains and can effectively reach users, thus facilitating to increase exchanges among players, to enhance the activity of games and to expand the play ways of games.

According to different sharing modes and sharing contents, the sharing scene is divided into structured sharing, music sharing, big picture sharing, backend sharing, link sharing (exclusive for WeChat), mobile QQ rich image sharing (exclusive for Android), mobile QQ video sharing (exclusive for Android), Mobile QQ ARK sharing,sharing WeChat videos to WeChat Moment, WeChat miniApp sharing.

This is the classic "left image and right text" sharing form. The content of each part is as follows:

Title: specified by share parameter "title"; the game can define it by itself according to the role or type of sharing.
Outline specified by share parameter "desc", commonly used to simply describe the purpose of sharing.
thumbnail specified by sharing parameter imgUrl or imgData; it is generally the game icon.
small tail generally composed of the game icon and game name; as long as you click the tail, you can launch the game. For more details, the game's operation manager can contact mobile QQ/ WeChat game center.

MSDK's share scenes and goals

MSDK share scene

Structured sharing

Structured sharing needs to launch mobile QQ/WeChat and can share messages to session and QZone and can't share them to WeChat Moments.

Big image sharing

Big image sharing needs to launch mobile QQ/WeChat. It can share messages to session, QZone and WeChat Moments.

music sharing

Music sharing needs to launch mobile QQ/WeChat. It can share messages to session, QZone and WeChat Moments. When you click music message, you can directly play music or skip to a music site to play music.

Share messages to session

Backend sharing

Backend sharing doesn't need to launch mobile QQ/WeChat. It can directly call interfaces in the game, that is, it can share messages to game friends.

a) WeChat's backend sharing message is displayed in friends' sessions. b) Mobile QQ's backend sharing message is presented the target player through mobile QQ's official account "QQ Mobile Game".

Note:The recipient needs to pay attention to the official account "QQ Mobile Game" so as to receive the message. The same user can receive about 20 pieces of messages about the same game on the same day.

WeChat link sharing

WeChat link sharing needs to launch WeChat to share messages. A click on the message can open the webpage.

Mobile QQ rich sharing

Mobile QQ rich sharing can send rich images to QZone through launching mobile QQ. It can upload multiple images (<=9 images to QZone;>9 images to the album), and support gif images.

Share messages to QZone

Mobile QQ video sharing

mobile QQ video sharing can share local videos to Qzone through launching mobile QQ.

Mobile QQ ARK sharing

ARK sharing needs to launch mobile QQ. It can be shared to session and QZone.

Access Guide

1 Preconditions

a) You have completed initialization according to the initialization module's description initialization
b) Make sure that your game's share permissions have been opened. After the game completes registration, the appropriate permissions will be opened based on your game category. If you call the login interface, "-303, no permission" is returned. Please contact MSDK's joint debugging support staff.
c)Confirm that the user has completed mobile QQ/WeChat authorized login

2 Refer to demos

For examples of mobile QQ sharing, refer to the Share section in MSDKDemo/LoginSucceedVC.mm.

For examples of WeChat sharing, please refer to the Share section in MSDKDemo/LoginSucceedVC.mm .

3 Call this module's other interfaces

After completing Step1-Step2, you have access to this module and can directly call other interfaces of the module without any additional configuration. Every part of the module is described below.

1) Structured sharing: structured sharing needs to launch mobile QQ/WeChat, and the display form of the sharing content is the "left image and right text" structure.

2) Big image sharing: Big image sharing needs to launch mobile QQ/WeChat, and the display form of the sharing content is a piece of image.

3) Music sharing: music sharing needs to launch mobile QQ/WeChat, and the display form of the sharing content is the "left image and right text" structure. Click on the image can directly play music or skip to the link to play music.

4) Backend sharing: backend sharing doesn't need to launch mobile QQ/WeChat. It can directly call interfaces in the game, that is, it can share messages to game friends.

5) WeChat link sharing: WeChat link sharing needs to launch WeChat to share messages. A click on the message can open the webpage.

6) Mobile QQ rich sharing: mobile QQ rich sharing can send rich images to QZone through launching mobile QQ.

7) Mobile QQ video sharing: mobile QQ video sharing can share local videos to QZone through launching mobile QQ.

8)Mobile QQ ARK sharing:ARK sharing needs to launch mobile QQ. It can be shared to session and QZone.

9) Mobile QQ game center's details page: mobile QQ game center's details page is a page that mobile QQ provides to every premium game to display its details in the game center. The page provides the capabilities of downloading, displaying and skipping games.

Structured sharing

General description

Structured sharing needs to launch mobile QQ/WeChat and can share messages to session and QZone and can't share them to WeChat Moments.

Handle callback

1)Function description

To receive MSDK's share callback, you need to handle OnShareNotify.

2)Interface declaration
virtual void OnShareNotify(ShareRet& shareRet) = 0;
3)Parameter description
Parameter name Type Description
shareRet ShareRet class Sharing result information class
4)Return value

None

5)Demo code
void MyObserver::OnShareNotify(ShareRet& shareRet)
{
    switch (shareRet.flag)
    {
        case eFlag.eFlag_Succ:
        // TODO GAME Sharing is successful
           break;
        case eFlag.eFlag_QQ_UserCancel:
        case eFlag.eFlag_WX_UserCancel:
        case eFlag.eFlag_WX_NotInstall:
        default:
        // TODO GAME Sharing fails
           break;
     }
};
6)Special description

None

7)Term interpretation

None

WeChat structured sharing

1)Function description

You can call WGSendToWeixin interface to share the structured message to a WeChat session.

2)Interface declaration
void WGSendToWeixin(
                        unsigned char* title,
                        unsigned char* desc,
                        unsigned char* mediaTagName,
                        unsigned char* thumbImgData,
                        const int& thumbImgDataLen,
                        unsigned char* messageExt
                        unsigned char* userOpenId);//3.3.0 version starts to add userOpenId parameter
                        );
3)Parameter description
Parameter name Type Description
title unsigned char* title; size can't exceed 512 byte
desc unsigned char* Summary information; size can't exceed 1K
mediaTagName unsigned char* This value will be passed to WeChat for statistics. Click Specification to see the details.
thumbImgData unsigned char* thumbnail file data
thumbImgDataLen const int& the length of thumbnail data; size can't exceed 32K
messageExt unsigned char* the game's self-defined passthrough field. For details, please refer to the following special description;If you don't need it, you can fill in an empty string.
userOpenId unsigned char * Specify to share to a specific friend (can be empty string, openid or sopenid); the 3.3.0 version starts to add this parameter
4)Return value

None, the sharing result is returned to the game through OnShareNotify callback

5)Demo code
UIImage *image = [UIImage imageNamed:@"music.jpg"];
NSData *data = UIImageJPEGRepresentation(image, 1.0);
WGPlatform::GetInstance()->WGSendToWeixin((unsigned char*)"Share title",
                                          (unsigned char*)"Share content",
                                          (unsigned char*)"MSG_INVITE",
                                          (unsigned char*)[data bytes],
                                          (int)[data length],
                                          (unsigned char*)"msdkwuwuwu"),
                                          (unsigned char *)"");//3.3.0 version starts to add userOpenId parameter
6)Special description

Parameter messageExt can be passed back to the game through the player's click on the shared message after the message is shared. The specific process: player A shares WeChat message (with messageExt parameter) to player B; player B clicks the received message to launch the game, and player B's game client will receive the callback event OnWakeupNotify(WakeupRet &wakeupRet). wakeupRet.messageExt is messageExt parameter passed by player A in the time of sharing a message. For the registration of OnWakeupNotify, please refer to Account inconsistency handling.

7)Term interpretation

None

Mobile QQ structured sharing

1)Function description

You can call WGSendToQQ interface to share structured messages to QQ session or QZone;Support QZone's new capability. For details, please refer to the description of QZone's new capability.

2)Interface declaration
void WGSendToQQ(
                const eQQScene& scene,
                unsigned char* title,
                unsigned char* desc,
                unsigned char* url,
                unsigned char* imgData,
                const int& imgDataLen,
                unsigned char *tagname,//3.3.18 version starts to add this parameter
                unsigned char *messageExt);//3.3.18 version starts to add this parameter
                );
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration flag is sent to mobile QQ session or Qzone
title unsigned char* title; the length of string can't exceed 128
desc unsigned char* Summary information; the length of string can't exceed 512
url unsigned char* the content's skip Url
imgData unsigned char* thumbnail file data;the image size cannot exceed 1M
imgDataLen const int& the length of thumbnail data
tagname unsigned char * 3.3.18 version starts to add this parameter; this value can be passed to QQ for statistical use
messageExt unsigned char * 3.3.18 version starts to add this parameter; it is the game's self-defined transmission field. You can fill in it with an empty string if you don't need it
4)Return value

None, the sharing result is returned to the game through OnShareNotify callback

5)Demo code
WGPlatform::GetInstance()->WGSendToQQ((eQQScene)cScene, 
                                      (unsigned char *)"QQ分享-title", 
                                      (unsigned char *)"QQ分享-desc", 
                                      (unsigned char *)"https://speed.gamecenter.qq.com/pushgame/v1/detail?appid=100703379&_wv=2164260896&_wwv=448&autodownload=1&autolaunch=1&autosubscribe=1&ADTAG=gameobj.msg_invite&gamedata=gamedata", 
                                      (unsigned char *)"http://qzonestyle.gtimg.cn/open_proj/proj_open_v2/ac/home/qrcode.jpg", 
                                      imgUrlLen,
                                      (unsigned char *)"tagname",//3.3.18 version starts to add this parameter
                                      (unsigned char *)"messageExt" );//3.3.18 version starts to add this parameter
6)Special description

url If url is filled with the mobile QQ Game Center's details page link, click on the message can launch the game and return the custom parameters. For details, please refer to:mobile QQ game center's details page

7)Term interpretation

None

8) The description 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
- External access (based on km documentation): https://docs.qq.com/doc/DY2lhTHRld05aaU12

Access documentation of QZone's new sharing capability (provided by the platform):
- Internal access: http://km.oa.com/group/mobileqqgamecenter/articles/show/387806
- External access (based on km documentation): https://docs.qq.com/doc/DY3BOZFpyR3N0Tkx6

It is needed to communicate with the platform to access QZone's new sharing capability. Contact MSDK Assistant for specific usage methods

The special description of QZone's new capability:
  1. When an image is shared to QZone, targetUrl passes hoplink and imgUrl passes the shared image(Image example: http://qzonestyle.gtimg.cn/open_proj/proj_open_v2/ac/home/qrcode.jpg;Note: This link can only be used for the project to verify and see the effect. After the project is released, it is needed to use the real address of the project side). The capability supports local images.
  2. When a video is shared to QZone, targetUrl passes the video's link(example link: https://v.qq.com/x/page/e08824fm35c.html?_sharetype=1&_shareid=12345&_appid=1106396765;Note: This link can only be used for the project to verify and see the effect. After the project is released, it is needed to use the real address of the project side), and imgUrl passes the thumbnail displayed when shared. The capability supports local images.

The effect of sharing an image to QZone is as follows:
此处需要添加图片 The effect of sharing a video to QZone is as follows:
此处需要添加图片

Advanced usage

1)Function description

When the game shares the structured message, it can attach a section of self-defined information (string) to the structured message. When another player clicks the message, this will automatically launch the game and passthrough the attached self-defined information to the game through OnWakeupNotify. This ability can be used to invite offline friends to combat and quickly join the combat room to play the game. For example:


1) Player A opens combat room 11. At this time, player B is not online;
2) Player A shares a QQ/Wechat structured message (attached self-defined information, such as room 11 and A's openid) to B;
3) B clicks the message in QQ/WeChat. At this time, this launches the game and passes the attached information (room 11 and A's openid, etc.) to the game client;
4) According to the attached room 11, A's openid and other information, the game lets B quickly join A's combat room 11. The two players can combat now.

2)Parameter description

WeChat can passthrough self-defined information through messageExt parameter in the interface WGSendToWeixin

QQ can passthrough self-defined information through setting targetUrl in the interface WGSendToQQ as the game center's details page Url and adding gamedata parameter. For example:

The game center's details page Url is:

http://gamecenter.qq.com/cdn/ios/detail_ios.html?plat=qq&appid=100703379&sid=AefJ54uwWnH7rW6xJwMM1aFI&uin=403261045&pf=invite

Add the self-defined information ”CustomData” in Url:

http://gamecenter.qq.com/cdn/ios/detail_ios.html?plat=qq&appid=100703379&sid=AefJ54uwWnH7rW6xJwMM1aFI&uin=403261045&pf=invite&gamedata=CustomData
3)Demo code

Click the shared message to start, receive and process the attached custom information:

void MyObserver::OnWakeupNotify(WakeupRet& wakeupRet)
{
    string gameCustomData = "";
    if ((int)ePlatform_QQ == ret.platform)
    {
        std::vector<KVPair> extInfo = ret.extInfo;
        foreach(KVPair pair in extInfo)
        {
            if ("gamedata".Equals(pair.key))
            {
                gameCustomData = pair.value;
                break;
            }
        }
    }
    else if ((int)ePlatform_Weixin == ret.platform)
    {
        gameCustomData = ret.messageExt;
    }
    ......
}

Big image sharing

General description

Big image sharing needs to launch mobile QQ/WeChat. It can share messages to session, QZone and WeChat Moments.

Handle callback

Refer to structured sharing's Handle the callback

WeChat big image sharing

1)Function description

You can call WGSendToWeixinWithPhoto interface to share big image messages to WeChat sessions and WeChat Moments.

2)Interface declaration
void WGSendToWeixinWithPhoto(
                             const eWechatScene &scene,
                             unsigned char *mediaTagName,
                             unsigned char *imgData,
                             const int &imgDataLen,
                             unsigned char *messageExt,
                             unsigned char *messageAction
                             );
3)Parameter description
Parameter name Type Description
scene eWechatScene enumeration flag is sent to WeChat session or Moments
mediaTagName unsigned char * This value will be passed to WeChat for statistics. Click Specification to see the details.
imgData unsigned char * thumbnail file data
imgDataLen const int & the length of thumbnail data; size can't exceed 32K
messageExt unsigned char * the game's self-defined passthrough field. For details, please refer to structured sharing's Special description;If you don't need it, you can fill in an empty string.
messageAction unsigned char * When sharing a circle of friends, the game can customize the behavior of the friend's small tail, details click here
4)Return value

None, the sharing result is returned to the game through OnShareNotify callback

5)Demo code
UIImage *image = [UIImage imageNamed:@"treasure.jpg"];
NSData *data = UIImageJPEGRepresentation(image, 1.0);
WGPlatform::GetInstance()->WGSendToWeixinWithPhoto(WechatScene_Session,
                                                   (unsigned char*)"MSG_INVITE",
                                                   (unsigned char*)[data bytes],
                                                   (int)[data length],
                                                   (unsigned char*)"",
                                                   (unsigned char*)"WECHAT_SNS_JUMP_APP");
6)Special description

None

7)Term interpretation

None

Mobile QQ Android big image sharing

1)Function description

You can call WGSendToQQWithPhoto interface to share big image messages to mobile QQ session and QZone.

2)Interface declaration
void WGSendToQQWithPhoto(
                         const eQQScene& scene,
                         unsigned char* imgData,
                         const int& imgDataLen,
                         unsigned char *tagname,//3.3.18 version starts to add this parameter
                         unsigned char *messageExt);//3.3.18 version starts to add this parameter
                         );
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration flag is sent to mobile QQ session or Qzone
imgData unsigned char* thumbnail file data
imgDataLen const int& the length of thumbnail data
tagname unsigned char * 3.3.18 version starts to add this parameter; this value can be passed to QQ for statistical use
messageExt unsigned char * 3.3.18 version starts to add this parameter; it is the game's self-defined transmission field. You can fill in it with an empty string if you don't need it
4)Return value

None, the sharing result is returned to the game through OnShareNotify callback

5)Demo code
WGPlatform::GetInstance()->WGSendToQQWithPhoto((eQQScene)cScene, 
                                               (unsigned char *)"/storage/sdcard0/test.jpg",
                                               (unsigned char *)"tagname",//3.3.18 version starts to add this parameter
                                               (unsigned char *)"messageExt");//3.3.18 version starts to add this parameter
6)Special description

None

7)Term interpretation

None

Mobile QQ big image sharing carries user-defined parameters

1)Function description

The capability of showing big pictures to QZone; mobile QZone needs to specifically tailor the incoming content to match the small tail's content seen by the user, so as to achieve the personalized operation result.

2)Interface declaration
void WGSendToQQWithPhoto(const eQQScene &scene,
                        ImageParams &imageParams,
                        const unsigned char *extraScene,
                        const unsigned char *messageExt);
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration Shared scene; currently only support QZone QQScene_QZone
imageParams ImageParams This struct has different fields between Android and iOS platforms. In Android, it is needed to fill in the video path: android_videoPath. In iOS, it is needed to read and fill in the image data ios_imageData and the image data length ios_imageDataLen.
extraScene unsigned char* Differentiate the shared scene, used for alienated small tail display and feeds click action
messageExt unsigned char* A field defined by the game itself; when you click the shared message to return back to the game, the field will be passthrough back to the game; If you don't need it, you can fill in an empty string.
4)Return value

None, the sharing result is returned to the game through OnShareNotify callback

5)Demo code
UIImage *image = [UIImage imageNamed:@"treasure.jpg"];
NSData *data = UIImageJPEGRepresentation(image, 1.0);
ImageParams imageParam;
imageParam.ios_imageData = (unsigned char *)[data bytes];
imageParam.ios_imageDataLen = (int)[data length];
WGPlatform::GetInstance()->WGSendToQQWithPhoto(QQScene_QZone, imageParam,(unsigned char *)"MESSAGE_ACTION_SNS_CANVAS#Honor=1" , (unsigned char *) "QZone with extra parameters");
6)Special description

None

7)Term interpretation

None

Backend sharing

General description

Backend sharing doesn't need to launch mobile QQ. It can directly call interfaces in the game, that is, it can share messages to game friends.

Handle callback

Refer to structured sharing's Handle the callback

Mobile QQ backend sharing

1)Function description

You can call WGSendToQQGameFriend interface to display the message in the friend's session or share it to the target user via QQ public account "QQ Mobile Games". The platform side of this interface no longer accepts game access. If you have special needs, please contact the mobile QQ game center to connect (the game that has been connected can continue to be used).
Note:

1.The shared content can be seen only on mobile QQ and can’t be seen on PC QQ.
Receiver: The same user can receive up to 5 pieces of message per day (receive up to 5 pieces from the same user per day) and can receive up to 20 pieces per week

2.Restrictions on sending and receiving messages:
(1) Structured message:
The same pair of numbers can send and receive messages to each other, and the number of interactions is once a day.
The receiver can receive up to 5 pieces of message per day and 20 per week
The sender can send up to 10 pieces of message per day and up to 40 pieces of message per week to different users
(2) ark message:
The receiver can receive up to 5 pieces of message per day and up to 3 pieces of message from the same person
The sender can send up to 30 pieces of message per day and up to 100 pieces of message per week.

3.Messages received through the public account of "QQ Mobile Games" will be issued on the platform side with a delay, and will be issued through the public account at three fixed time periods a day (currently at 12:00, 20:00 and 22:00 every day). A single user can receive up to 3 pieces of public account messages per day.

4.The following steps all need to contact Tencent's corresponding staff to dock.
(1) Provide the image copy and apply for gametag
(2) Input the new appid and gametag into the AMS process.
(3) Configure a game center details page for test (later can be changed into an official details page)
(4) After the interface access is completed, verify whether the sharing is successful

2)Interface declaration
bool WGSendToQQGameFriend(
                          int act,
                          unsigned char* fopenid,
                          unsigned char *title,
                          unsigned char *summary,
                          unsigned char *targetUrl,
                          unsigned char *imgUrl,
                          unsigned char* previewText,
                          unsigned char* gameTag,
                          unsigned char* msdkExtInfo
                          );
3)Parameter description
Parameter name Type Description
act int the action to click to share messages; 1: launch the game; the default is to launch the game
fOpenId unsigned char* the target player's openid
title unsigned char* title; the number of words can't exceed 40 characters
desc unsigned char* Summary information; the number of words can't exceed 120 characters
targetUrl unsigned char* the Game Center's details page address; for configuration, please refer to: https://wiki.ssl.msdk.qq.com/zh_EN/IOS/share.html#IOS_QGameCenter
imageUrl unsigned char* shared thumbnail Url; only network image Url
previewText unsigned char* preview text, optional, whose size can't exceed 45 bytes
gameTag unsigned char* gameTag is used for the platform statistics of share types, such as Heart Send share and Exceed share. Its value is set by the game developer and synchronized to the QQ platform. gameTag now has several values available. Only some of the values are listed for reference. Fill in a proper value after communicating with the QQ platform:
1.Receive the push message through the public account:
"MSG_INVITE":Invite
"MSG_FRIEND_EXCEED":Show off exceeding
"MSG_HEART_SEND":Send heart
"MSG_SHARE_FRIEND_PVP":PVP fight
2.Push and receive structured messages via C2C:
"MSG_RECALL":Recall
"MSG_INVITE_NEW":Invite
3.Ark messages:
"MSG_RECALL_ARK":Recall
"MSG_INVITE_ARK":Invite
"MSG_INVITE_FRIEND_ARK":Get new users
msdkExtInfo unsigned char* the game's user-defined passthrough field, which is returned to the game through sharing shareRet.extInfo in the callback OnShareNotify
4)Return value

false: parameter is illegal, and no share request is launched; true: the share request is launched successfully. The sharing result is returned to the game through OnShareNotify callback.

5)Demo code
WGPlatform::GetInstance()->WGSendToQQGameFriend(0,
                                               (unsigned char *)"E7B0E64C39A09127A698326F4941A9B6",
                                               (unsigned char *)"title",
                                               (unsigned char *)"desc",
                                               (unsigned char *)"http://bbs.oa.com",
                                               (unsigned char *)"http://bbs.oa.com",
                                               (unsigned char *)"PreviewText",
                                               (unsigned char *)"MSG_INVITE",
                                               (unsigned char *)"extMsdkInfo");
6)Special description

The shared content can only be seen on mobile QQ rather than on PC QQ. A user can receive a total of up to 5 pieces of shared messages a day from different users and up to 3 pieces from the same user a day.

7)Term interpretation

None

Backend sharing to group

General description

In the game guild/union, users can directly share structured messages to WeChat guild groups. Based on the interface, the game can do some marketing schemes. The calling interface is WGSendToWXGroup. The result will be called back to the game through OnShareNotify.

Registration callback

Refer to structured sharing's Registration callback

The backend shares messages to WeChat group

1)Function description

The interface doesn't need to launch WeChat and can directly share messages to the WeChat group of the guild which the player has joined.

2)Interface declaration
void WGSendToWXGroup(
     const int& msgType,
     const int& subType,
     unsigned char* unionID,
     unsigned char* title,
     unsigned char* desc,
     unsigned char* mediaTagName,
     unsigned char* imgUrl,
     unsigned char* messageExt,
     unsigned char* msdkExtInfo
);
3)Parameter description
Parameter name Type Description
msgType int message type; fill in 1 now
subType int share type; for "invite", fill in 1; for "show off", fill in 2; for "gift", fill in 3; for "request", fill in 4
unionID unsigned char* guild ID
title unsigned char* the shared content's title
desc unsigned char* the shared content's introduction
mediaTagName unsigned char* This value will be passed to WeChat for statistics. Click Specification to see the details.
imgUrl unsigned char* shared thumbnail URL
messageExt unsigned char* the game's self-defined passthrough field. For details, please refer to structured sharing'sSpecial description;If you don't need it, you can fill in an empty string.
msdkExtInfo unsigned char* the game's customized passthrough field, which is returned to the game through shareRet.extInfo
4)Return value

None, login information will be returned to the game through OnShareNotify callback.

5)Demo code
int msgType = 1;
int subType = 1;
std::string unionID = "1";
std::string title = "The backend shares messages to the guild WeChat group-title";
std::string desc = "The backend shares messages to WeChat friends-desc";
std::string mediaTagName = "MSG_INVITE";
std::string imgUrl = "http://blog.bihe0832.com/public/img/head.jpg";
std::string messageExt = "message Ext";
std::string msdkExtInfo = "msdkExtInfo";
WGPlatform::GetInstance()->WGSendToWXGroup(
        msgType,
        subType,
        (unsigned char *)unionID.c_str(),
        (unsigned char *)title.c_str(),
        (unsigned char *)desc.c_str(),
        (unsigned char *)mediaTagName.c_str(),
        (unsigned char *)imgUrl.c_str(),
        (unsigned char *)messageExt.c_str(),
        (unsigned char *)msdkExtInfo.c_str());
6)Special description

1.The interface needs to refer to guild id, so you must bind the guild to WeChat group before you can share messages. 2.The player must first join the guild group so that he can share messages. For details, please refer toGroup module

7)Term interpretation

None

music sharing

General description

Music sharing needs to launch mobile QQ/WeChat. It can share messages to session, QZone and WeChat Moments. When you click music message, you can directly play music or skip to a music site to play music.

Handle callback

Refer to structured sharing's Handle the callback

WeChat music sharing

1)Function description

You can call WGSendToWeixinWithMusic interface to share music messages to WeChat session and Moments.

2)Interface declaration
void WGSendToWeixinWithMusic(
                             const eWechatScene& scene,
                             unsigned char* title,
                             unsigned char* desc,
                             unsigned char* musicUrl,
                             unsigned char* musicDataUrl,
                             unsigned char *mediaTagName,
                             unsigned char *imgData,
                             const int &imgDataLen,
                             unsigned char *messageExt,
                             unsigned char *messageAction
                             );
3)Parameter description
Parameter name Type Description
scene eWechatScene enumeration flag is sent to WeChat session or Moments
title unsigned char* title; size can't exceed 512 byte
desc unsigned char* Summary information; size can't exceed 1K
musicUrl unsigned char* Skip Url after the message is clicked; its length can't exceed 10K
musicDataUrl unsigned char* Music data Url(such as http:// ***.mp3);its length can't exceed 10K
mediaTagName unsigned char* This value will be passed to WeChat for statistics. Click Specification to see the details.
imgData unsigned char* thumbnail file data
imgDataLen int the length of thumbnail data; size can't exceed 32k
messageExt unsigned char* the game's self-defined passthrough field. For details, please refer to structured sharing'sSpecial descriptionIf you don't need it, you can fill in an empty string.
messageAction unsigned char* Music sharing temporarily cannot define the small tail by itself and can pass null;When sharing a circle of friends, the game can customize the behavior of the friend's small tail, details click here
4)Return value

None, the sharing result is returned to the game through OnShareNotify callback

5)Demo code
WGPlatform::GetInstance()->WGSendToWeixinWithMusic(WechatScene_Session,
                                                  (unsigned char*)"Test music",
                                                  (unsigned char*)"Test music sharing",
                                                  (unsigned char*)"http://y.qq.com/#type=song&mid=000cz9pr0xlAId",
                                                  (unsigned char*)"http://tsmusic24.tc.qq.com/M500000cz9pr0xlAId.mp3",
                                                  NULL,
                                                  (unsigned char*)[data bytes],
                                                  (int)[data length],
                                                  NULL,
                                                  NULL);
6)Special description

None

7)Term interpretation

None

Mobile QQ music sharing

1)Function description

You can call WGSendToQQWithMusicinterface to share music messages to mobile QQ session and Qzone.

2)Interface declaration
void WGSendToQQWithMusic(
                         const eQQScene& scene,
                         unsigned char* title,
                         unsigned char* desc,
                         unsigned char* musicUrl,
                         unsigned char* musicDataUrl,
                         unsigned char* imgUrl
                         );
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration flag is sent to mobile QQ session or Qzone
title unsigned char* title; the length of string can't exceed 128
desc unsigned char* Summary information; the length of string can't exceed 512
musicUrl unsigned char* skip Url after clicking the message
musicDataUrl unsigned char* music data Url(such as http:// ***.mp3)
imgUrl unsigned char* shared message's thumbnail Url; local path or network Url
4)Return value

None, the sharing result is returned to the game through OnShareNotify callback

5)Demo code
WGPlatform::GetInstance()->WGSendToQQWithMusic(QQScene_QZone,
                                               (unsigned char*)"Test music",
                                               (unsigned char*)"Test music sharing",
                                               (unsigned char*)"http://y.qq.com/#type=song&mid=000cz9pr0xlAId",
                                               (unsigned char*)"http://tsmusic24.tc.qq.com/M500000cz9pr0xlAId.mp3",
                                               (unsigned char*)"http://www.monsterworking.com/wp-content/uploads/music.jpg");
6)Special description

None

7)Term interpretation

None

Send WeChat group message

1)Function description

In the game, send structured messages to WeChat group.

2)Interface declaration
void WGSendToWXGroup(
                     const int& msgType,
                     const int& subType,
                     unsigned char* unionID,
                     unsigned char* title,
                     unsigned char* desc,
                     unsigned char* messageExt,
                     unsigned char* mediaTagName,
                     unsigned char* imgUrl,
                     unsigned char* msdkExtInfo
                    );
3)Parameter description
Parameter name Type Description
msgType int message type: 1:open 2:link(unrealized) 3:voice(unrealized) 4:text(unrealized)
subType int Sub-type: 1:invitation (fill 1) 2: show off 3: give away 4: request
unionID unsigned char* guild ID
title unsigned char* title
desc unsigned char* description
messageExt unsigned char* Game sharing is to pass in a string, through which the game can be launched. The result will be returned to the game through ret.messageExt in OnWakeUpNotify;If you don't need it, you can fill in an empty string.
mediaTagName unsigned char* This value will be passed to WeChat for statistical use. The following values are optional.
"MSG_INVITE" : invite
"MSG_SHARE_MOMENT_HIGH_SCORE" : share this week's highest score to WeChat Moments
"MSG_SHARE_MOMENT_BEST_SCORE" : share the history's highest score to WeChat Moments
"MSG_SHARE_MOMENT_CROWN" : share a golden crown to WeChat Moments
"MSG_SHARE_FRIEND_HIGH_SCORE" : share this week's highest score to friends
"MSG_SHARE_FRIEND_BEST_SCORE" : share the history's highest score to friends
"MSG_SHARE_FRIEND_CROWN" : share a golden crown to friends
"MSG_friend_exceed" : exceed and show off
"MSG_heart_send" : send a heart
imgUrl unsigned char* image CDN url
msdkExtInfo unsigned char* The game’s user-defined passthrough field, which is returned to the game through shareRet.extInfo in OnShareNotify
4)Return value

None, the call result will be called back to the game through OnShareNotify

5)Demo code
WGPlatform::GetInstance()->WGSendToWXGroup(1,
                                           1,
                                           (unsigned char*)[unionId UTF8String],
                                           (unsigned char*)"WXGroup Title",
                                           (unsigned char*)"WXGroup Desc",
                                           (unsigned char*)"messageExt",
                                           (unsigned char*)"MSG_INVITE",
                                           (unsigned char*)"http://mmocgame.qpic.cn/wechatgame/mEMdfrX5RU3uZS2DPHjgjMZEVAOwVZ9ovTytliapMYJD5mQfffyXsUBFSkINlxUVk/0",
                                           (unsigned char*)"msdkExtInfo");    
6)Special description

Among parameters, unionID, title, desc and mediaTagName can't be empty.

7)Term interpretation

None

WeChat link sharing

General description

WeChat link sharing needs to launch WeChat to share messages. A click on the message can open the webpage.

Handle callback

Refer to structured sharing's Handle the callback

WeChat link sharing

1)Function description

You can call WGSendToWeixinWithUrl interface to share link messages to WeChat session and Moments.

2)Interface declaration
void WGSendToWeixinWithUrl(
                           const eWechatScene& scene,
                           unsigned char* title,
                           unsigned char* desc,
                           unsigned char* url,
                           unsigned char* mediaTagName,
                           unsigned char* thumbImgData,
                           const int& thumbImgDataLen,
                           unsigned char* messageExt,
                           unsigned char *userOpenId);//3.3.0 version starts to add userOpenId parameter
                           );
3)Parameter description
Parameter name Type Description
scene eWechatScene enumeration flag is sent to WeChat session or Moments
title unsigned char* title; size can't exceed 512 byte
desc unsigned char* Summary information; size can't exceed 1K
url unsigned char* Click the destination URL which can be opened; its length can't exceed 10K
mediaTagName unsigned char* This value will be passed to WeChat for statistics. Click Specification to see the details.
thumbImgData unsigned char* thumbnail file data
thumbImgDataLen int the length of thumbnail data; size can't exceed 32K
messageExt unsigned char* the game's self-defined passthrough field. For details, please refer to structured sharing'sSpecial description ;If you don't need it, you can fill in an empty string.
unsigned char *userOpenId);//3.3.0 version starts to add userOpenId parameter
4)Return value

None, the sharing result is returned to the game through OnShareNotify callback

5)Demo code
WGPlatform::GetInstance()->WGSendToWeixinWithUrl(WechatScene_Session,
                                                 (unsigned char*)"Share title",
                                                 (unsigned char*)"Share content",
                                                 (unsigned char*)"http://www.baidu.com",
                                                 (unsigned char*)"MSG_INVITE",
                                                 (unsigned char*)[data bytes],
                                                 (int)[data length],
                                                 (unsigned char*)"msdkwuwuwu");
                                                 (unsigned char*)"");//3.3.0 version starts to add userOpenId parameter
6)Special description

None

7)Term interpretation

None

Mobile QQ rich sharing

1 General description

Mobile QQ rich sharing can send rich images to QZone through launching mobile QQ. It can upload multiple images (<=9 images to QZone;>9 images to the album), and support gif images.

2 Registration callback

Refer to structured sharing's Registration callback

3 Mobile QQ rich sharing

1)Function description

You can call WGSendToQQWithRichPhoto interface to launch mobile QQ to upload multiple images (including gif animated images) to QZone.

2)Interface declaration
void WGSendToQQWithRichPhoto(unsigned char *summary, std::vector<std::string> &imgFilePaths)

//The 3.3.0 version begins with the interface changes as follows
void WGSendToQQWithRichPhoto(unsigned char *summary, std::vector<ImageParams> &imgParams , const unsigned char *extraScene, const unsigned char *messageExt)
3)Parameter description
Parameter name Type Description
summary unsigned char* The text of the shared message; this parameter is currently invalid
imgFilePaths vector This parameter has been discarded since 3.3.0; the collection of multiple images shared; only support local images, and need QQ client version greater than or equal to 5.9.5
imgParams ImageParams This parameter has been created since 3.3.0; the collection of multiple images shared; only support local images, and need QQ client version greater than or equal to 5.9.5; for android users, they need to fill in the image path: android_imagePath
extraScene unsigned char* This parameter has been created since 3.3.0; it is used to distinguish the shared scene and used to differentiate the small tail display and feeds click behavior; need to communicate with the space side’s contact person to define it; contact person: qqconnecthelper
messageExt unsigned char* This parameter has been created since 3.3.0; it is a field defined by the game; when the shared message is clicked and you've come back to the game, the field will be transparently passed back to the game; if you don't need it, you can fill in an empty string
4)Return value

None, login information will be returned to the game through WGPlatformObserver callback

5)Demo code
std::string cSummary = "The wonderful moment of my game";
WGPlatform::GetInstance()->WGSendToQQWithRichPhoto((unsigned char *)cSummary.c_str(), imgFilePaths);

//The 3.3.0 version begins with the interface changes as follows
WGPlatform::GetInstance()->WGSendToQQWithRichPhoto((unsigned char *)cSummary.c_str(), imgParams,
                                               (unsigned char *)"1",
                                               (unsigned char *)"msdk");
6)Special description

Local images in imgs should be stored at a place which mobile QQ can access, such as sdcard storage area (/storage/sdcard0)

7)Name interpretation

None

Mobile QQ ARK sharing

1 General description

ARK sharing needs to launch mobile QQ. It can be shared to session. ARK sharing needs to provide AppId to add mobile QQ whitelist and communicate with mobile QQ about the specific protocol.

2 Registration Callback

Please refer to structured sharing’sRegistration Callback

3 Mobile QQ iOS ARK sharing

1)Functional description

You can call WGSendToQQWithArk interface to share ARK messages to mobile QQ session.

2)Interface declaration
void WGSendToQQWithArk(
                           const eQQScene& scene,
                           unsigned char* title,
                           unsigned char* desc,
                           unsigned char* url,
                           unsigned char* imgUrl,
                           unsigned char* jsonString,
                           unsigned char* tagname,//3.3.18 version starts to add this parameter
                           unsigned char* messageExt);//3.3.18 version starts to add this parameter
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration dentify the sending of mobile QQ session; scene only supports QQ session and does not support QZone
title unsigned char * title; cannot exceed 80 bytes
desc unsigned char * content information; cannot exceed 130 bytes
url unsigned char * The jump URL of the content; fill in the game’s corresponding game center details page; it is recommended not to exceed 120 bytes, if it exceeds the limit, the longer URL will be shortened
imgUrl unsigned char * URL of the shared message thumbnail; local path or network URL; image size cannot exceed 1M
jsonString unsigned char * ARK sharing jsonString (when developing a project, the business side shall consult with mobile QQ ARK about how to configure this parameter. MSDK only makes transparent transmission of the parameter)
tagname unsigned char * 3.3.18 version starts to add this parameter; this value can be passed to QQ for statistical use
messageExt unsigned char * 3.3.18 version starts to add this parameter; it is the game's self-defined transmission field. You can fill in it with an empty string if you don't need it
4)Return value

None. The sharing result is sent back to the game via WGPlatformObserver calling back OnShareNotify function

5)Demo code
WGPlatform::GetInstance()->WGSendToQQWithArk((eQQScene)cScene, 
                    (unsigned char *)"it's title",
                    (unsigned char *)"it's desc", 
                    (unsigned char *)"http://gamecenter.qq.com/gcjump?appid=100703379&pf=invite&from=iphoneqq&plat=qq&originuin=111&ADTAG=gameobj.msg_invite", 
                    (unsigned char *)"http://q.qlogo.cn/qqapp/100703379/C1BF66286792F24E166C9A5D27CFB519/100",
                    (unsigned char*)""{"app":"com.tencent.gamecenter.gameshare","view":"noDataView","desc":"emplate description","prompt":"message prompt","ver":"0.0.0.1","config":{"type":"normal"},"meta":{"shareData":{"appid":"1104466820","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"}]}}}"",
                    (unsigned char *)"tagname",//3.3.18 version starts to add this parameter
                    (unsigned char *)"messageExt");//3.3.18 version starts to add this parameter
6)Special remarks

Note: In order to use this function normally, developers need to know the following information:

  • For versions prior to QQ client 8.0.0, when ARK sharing fails, it will automatically be converted into a structured message for sharing. The incoming parameters are: title, desc, url and imgUrl, which are the parameters of the structured message. When ARK sharing is successful, title, desc, url and imgUrl have no effect.
  • Starting from QQ client 8.0.0 version, ARK parameters must be filled in correctly; if the parameters are not filled in, the message in ARK form will not be successfully shared; if the parameters are filled in wrongly, the sharing will fail.
  • You need to register your product in the official management side of ARK and create and submit your ARK card materials. Only after the materials pass the review can the corresponding permissions be opened for your product. The address of the management side:
    http://arkapp.oa.com:8080/app_light/dst/index.html#/ (The address is for intranet access and can be handled by Tencent's corresponding operation contact person. As for the review and shelf of the card template and other related issues, please consult with ARK_Helper ).

ARK client sharing needs to communicate with the QQ Game Center about how to access the center. As for the detailed process. please refer to: http://km.oa.com/group/39817/articles/show/375226 (the process document is for intranet access and needs the game’s corresponding Tencent operation contact person to view and contact the Game Center for configuration; the Game Center’s contact persons: ARK_Helper)

7)Term interpretation

None.

Mobile QQ game center's details page

General description

Mobile QQ game center's details page is a page that mobile QQ provides to every premium game to display its details in the game center. The page provides the capabilities of downloading, displaying and skipping games. Before its use, it needs the game operation manager to configure it in the mobile QQ game center. If the targetUrl parameter of mobile QQ sharing is filled with mobile QQ game center's details page link, click on the shared message can skip to the game's details page in the game center and then automatically launch the game.

Example of the game center's details page link:

http://gamecenter.qq.com/gcjump?appid=100703379&pf=invite&plat=qq&from=androidqq&
ADTAG=gameobj.msg_invite&originuin=61793295&gamedata=gamedata;

Field specification:

field description
appid the game's unique identifier ID in mobile QQ game center
_wv Fixed as 2164260896
_wwv Fixed as 448
autodownload Can be configured as 1, 0; 1 means starting the download when the game is not downloaded and launching the game when the game is downloaded; 0 means the opposite
autolaunch Can be configured as 1, 0; 1 means launching the game; 0 means the opposite
autosubscribe Can be configured as 1, 0; 1 means automatic reservation; 0 means the opposite
ADTAG mark different structured message sources; possible values:
gameobj.msg_invite: invite
gameobj.msg_exceed: exceed
gameobj.msg_heart: send heart
gameobj.msg_pvp: challenge
gameobj.msg_show: show off
gamedata data passthrough to the game;iOS platform doesn't support json format

Carry the login state:

If the game needs to carry the login state when clicking the shared message to launch the game (or the game center launches the game), it needs the game operation manager to configure it in the mobile QQ game center.

Return the custom parameter:

In mobile QQ sharing, the game's custom parameters can be passed back to the game client when another player clicks the shared message to launch the game. By using this feature, the game can invite offline players to play and achieve other play ways. In mobile QQ sharing, if targetUrl parameter is filled with mobile QQ game center's details page link, and optional field gamedata is filled with the game's custom parameter; when the player clicks this shared message to launch the game, the game client will receive the wakeup callback WakeupEven. wakeupRet passes through gamedata fields in mobile QQ game center's details page link.

Example of getting custom parameters:

void MyObserver::OnWakeupNotify(WakeupRet& wakeupRet)
{
    // TODO GAME
    std::string gamedata;
    std::vector<KVPair> pairs = ret.extInfo;
    foreach(KVPair pair in pairs)  
    {
        if (pair.key.Equals("gamedata"))
        {
            gamedata = pair.value;
        }
    }
}

Wherein, about how to handle OnWakeupNotify, please refer to Account inconsistency handling.

Share Messages to WeChat GameLine

1)Function descriptione

Allow users to open WeChat GameLine through inside webview to share images and texts to WeChat GameLine.

2)Interface declaration

void WGShareToWXGameline(unsigned char* imgData,const int& imgDataLen,unsigned char* gameExtra);

3)Parameter description

Parameter name Type Description
imgData unsigned char* Shared image data
imgData int shared image data length
gameExtra unsigned char* A parameter defined the game itself for sharing; the parameter will be appended behind url

4)Return value

None.

5)Demo code

UIImage *image = [UIImage imageNamed:@"news.jpg"];
NSData* data = UIImageJPEGRepresentation(image, 1.0);
WGPlatform::GetInstance()->WGShareToWXGameline((unsigned char*)[data bytes],(int)[data length],(unsigned char*)"10000");

6)Special description

The size of the image data can't exceed 512K. Images greater than the size needs to be compressed by game developers themselves. MSDK won't process the images gameExtra is a parameter defined the game itself. It is recommended that it be passed after the business processes it with Base64 encoding. MSDK only does this parameter passthrough without any treatment. At the same time, it is needed to ensure that this parameter's length conforms to URL length requirements.

7)Term interpretation

None

WeChat DeepLink

1)Function descriptione

WeChat DeepLink function refers to calling WGOpenWeiXinDeeplink interface in the game to directly launch WeChat and to skip to WeChat Game Center's home page, details page, game library and custom URL. For the opening and configuration of DeepLink function, please contact WeChat Game Center.This feature has been available since MSDK2.12.0i.

2)Interface declaration

void WGOpenWeiXinDeeplink(unsigned char* link);

3)Parameter description

Parameter name Type Description
link unsigned char* Specifically skip to deeplink; its value can be filled with INDEX, DETAIL, LIBRARY and custom URL. The meaning of each value is:
INDEX: skip to WeChat Game Center's home page
DETAIL: skip to WeChat Game Center's details page
LIBRARY: skip to WeChat Game Center's game library
Custom URL: skip to WeChat Webview and open the URL (This URL needs to be pre-configured in WeChat Game Center)

4)Return value

None.

5)Demo code

WGPlatform::GetInstance()->WGOpenWeiXinDeeplink((unsigned char*)"INDEX");

6)Special description

  1. For DeepLink function, it is needed to contact WeChat Game Center to open and configure it.

  2. Custom URL needs to be pre-configured in WeChat Game Center and exactly matched with the parameter characters passed by the called interface. If "http://www.qq.com/" is configured in WeChat Game Center, the interface's "link" parameter must pass "http://www.qq.com/". If it passes http://www.qq.com, this will fail.

7)Term interpretation

None

MiniApp Sharing

1 General description

MiniApp sharing needs to launch mobile QQ/WeChat. It can share messages to session, QZone.

2 Registration callback

Refer to structured sharing's Registration callback

3 WeChat miniapp sharing

1)Function descriptione

WeChat-based miniApps provide new sharing capabilities.

2)Interface declaration

 void WGSendToWXWithMiniApp(const eWechatScene &scene,
                            const unsigned char *title,
                            const unsigned char *desc,
                            const unsigned char *thumbImgData,
                            const int  &thumbImgDataLen,
                            const unsigned char *webpageUrl,
                            const unsigned char *userName,
                            const unsigned char *path,
                            bool  withShareTicket,
                            const unsigned char *messageExt,
                            const unsigned char *messageAction),
                            const unsigned char *mediaTagName,//3.3.0 version starts to add mediaTagName parameter
                            const eMiniProgramType &type,//3.3.0 version starts to add type parameter
                            const unsigned char *userOpenId);//3.3.0 version starts to add userOpenId parameter

3)Parameter description

Parameter name Type Description
scene eWechatScene Sharing scene (session/WeChat Moment); currently only support to share messages to session
unsigned char* sharing title, whose length can't exceed 512 bytes
desc unsigned char* description, whose length can't exceed 1K bytes
thumbImgData unsigned char* miniApp's thumbnail, iOS: not more than 32K (old version), not more than 128K (new version); Android: not more than 32K (old version)
thumbImgDataLen int miniApp thumbnail length
webpageUrl unsigned char * Compatible URL which common pages can skip to when WeChat opens this miniApp for sharing (optional URL, used for being compatible with older versions)
userName unsigned char* miniApp username, such as gh_d43f693ca31f
path unsigned char* miniApp path; through this field, you can specify a page which miniApp skips to (if the field is not passed, miniApp will skip to the home page by default);For mini-games having no webpage, it is allowed to only pass in the "query" part to achieve the parameter effect, such as: pass in "?foo=bar";User-defined parameters can be spliced into a string, which has a length of 100-200k. If the string is too long, it can cause cross-process transmission failure; such as: page/indexSelAddr/index?key1=value1&key2=value2
withShareTicket bool Is the message forwarded with shareTicket? (if the miniApp page wants to display the user dimension data and miniApp may share the message to the group, it is needed to set the field to YES)
messageExt unsigned char* The user-defined string passed in when the game shares something. The game can be launched through the message. The message can be passed back to the game via ret.messageExt in OnWakeUpNotify (WakeupRet ret), i.e. the transparently passed parameter.
messageAction unsigned char* MiniApp sharing temporarily cannot define the small tail by itself and can pass null;When sharing a circle of friends, the game can customize the behavior of the friend's small tail, details click here
mediaTagName unsigned char* 3.3.0 version started to create this parameter
This value will be passed to WeChat for statistics. Click Specification to see the details.
type eMiniProgramType Specify the miniApp version, which is divided into Release(0), Test(1) and Preview(2) versions; correspond to the miniApp version; 3.3.0 version started to create this parameter
userOpenId unsigned char* Specify to share messages to a specific friend; this parameter can pass an empty string or openid or sopenid;3.3.0 version started to create this parameter

4)Return value

 By setting the global callback OnShareNotify (ShareRet & shareRet), call back and return data to the game; shareRet.flag value ​​represents the return status. Its possible values ​​and descriptions are as follows:
 eFlag_Succ: Sharing is successful
 eFlag_Error: Sharing fails

5)Demo code

    WGPlatform::GetInstance()->WGSendToWXWithMiniApp(WechatScene_Session,
                                                     (unsigned char*)"miniApp sharing test",
                                                     (unsigned char*)"have a test",
                                                     (unsigned char*)data,
                                                     (int)dataLens,
                                                     (unsigned char*)"https://www.baidu.com",
                                                     (unsigned char*)"gh_e9f675597c15",
                                                     (unsigned  char*)"page/indexSelAddr/index",
                                                     true,
                                                     (unsigned char*)"",
                                                     (unsigned char*)"");
                                                     (unsigned char *)"MSG_INVITE",//3.3.0 version starts to add mediaTagName parameter
                                                     ProgramType_Release,//3.3.0 version starts to add type parameter
                                                     (unsigned char*)"");//3.3.0 version starts to add userOpenId parameter

6)Special description

App and miniApp which want to launch sharing belong to the same WeChat open platform account.
If WeChat client version is lower than 6.5.6, miniApp sharing will automatically turn into webpage sharing. Developers must fill in the webpage link field to ensure that lower versions of client can open the webpage link.
The method to get miniApp's original ID: loginto miniApp's backend - Settings - Basic Settings - Account Information.

7)Term interpretation

None

4 QQ miniapp sharing

1)Function description

You can call WGSendToQQWithMiniApp interface to share the message to QQ session and QZone.

2)Interface declaration
void WGSendToQQWithMiniApp(
            const eQQScene &scene,
            unsigned char *title,
            unsigned char *desc,
            unsigned char *url,
            ImageParams &imageParams,
            unsigned char *miniProgramAppid,
            unsigned char *miniProgramPath,
            const eMiniProgramType &type = ProgramType_Release);
3)Parameter description
Parameter name Type Description
scene eQQScene Send the identifier to QQ session or Qzone (QZone requires QQ client version 4.5 and above support)
title unsigned char * title of structured message
desc unsigned char * summary information of structured message
url unsigned char * Web link of compatible lower versions
imageParams ImageParams The corresponding fields of this struct are different on Android and iOS. Android needs to fill in the image path: android_imagePath
miniProgramAppid unsigned char * The miniApp appid bound to the game. Bind miniApp at connect.qq.com. Such binding works only when the game and miniApp must be the same subject
miniProgramPath unsigned char * The path of the miniApp page; starting from version 3.3.12, the user-defined message can be transmitted through this field. This just requires to append the key-value behind the path, such as: miniProgramPath = pages/index/index?key1=value1&key2 =value2
type eMiniProgramType miniApp type, divided into official version (0) and trial version (1)
4)Return value

None, the sharing result will be returned to the game through WGPlatformObserver callback

5)Demo code
WGPlatform::GetInstance()->WGSendToQQWithMiniApp((eQQScene)cScene, 
                                               (unsigned char *)"sendtoqq title",
                                               (unsigned char *)"sendtoqq summary", 
                                               (unsigned char *)"https://speed.gamecenter.qq.com/pushgame/v1/detail?appid=100703379&_wv=2164260896&_wwv=448&autodownload=1&autolaunch=1&autosubscribe=1&ADTAG=gameobj.msg_invite&gamedata=gamedata", 
                                               imageParams,
                                               (unsigned char *)"1109787314",
                                               (unsigned char *)"pages/index/index",
                                               ProgramType_Release);    
6) Special instructions

imageParams needs to fill in the image path.

Starting from version 3.3.12, the 'miniProgramPath' parameter can carry user-defined transmission message. Just append the key-value after the path, such as: Original miniProgramPath transmission parameter miniProgramPath = pages/index/index

Carry user-defined message, such as: after carrying the group message miniProgramPath = pages/index/index?key1=value1&key2=value2

Receive the user-defined transmission message in the account inconsistency. The 'wakeupRet.messageExt' of 'OnWakeupNotify' is the user-defined message passed when the player shares it, and 'messageExt' is a string, namely {"key1": "value1","key2": "value2"}, in JSON format for transmission parameters. When QQ miniApp wakes up App, if it does not carry any user-defined message, there will be no 'OnWakeupNotify' callback generated. For the registration of 'OnWakeupNotify', refer to Account Inconsistency Handling.

{
    // TODO GAME receives user-defined transmission message in account inconsistency, such as: QQ group message
    if (eFlag.eFlag_Succ == wakeupRet.flag || eFlag.eFlag.eFlag_NeedLogin == wakeupRet.flag              {
        var messageExt = wakeupRet.messageExt;
        // messageExt is a string, namely {"key1": "value1","key2": "value2"}, in JSON format for transmission parameters
    }
};
7)Term explanation

None

Share the pure text to QZone

1)Function Description

You can call WGSendToQQWithText interface to share the pure text to QZone. 3.3.0 version started to create this interface

2)Interface declaration

void WGSendToQQWithText(unsigned char* text, unsigned char* extraScene, unsigned char* messageExt);

3)Parameter Description

Parameter Name Type Description
text unsigned char* The content to be shared
extraScene unsigned char* This parameter is used to distinguish the shared scene and to differentiate the small tail display and feeds click behavior; need to communicate with the space side’s contact person to define it; contact person: qqconnecthelper
messageExt unsigned char* This parameter is a field defined by the game; when the shared message is clicked and you've come back to the game, the field will be transparently passed back to the game; if you don't need it, you can fill in an empty string

4)Return Value

No. The shared result is sent back to the game via the OnShareNotify callback

5)Demo code

    WGPlatform::GetInstance()->WGSendToQQWithText((unsigned char*)"text",
                                                  (unsigned char *)"1",
                                                  (unsigned char *)"msdk");

6)Special description

None

7)Term interpretation

None

Start miniApp

1 Start WeChat miniApp

1)Function Description

You can call WGLaunchMiniApp interface to start miniApp. 3.3.0 version started to create this interface.Starting from version 3.3.17, the callback is adjusted from OnShareNotify to OnWakeUpNotify, and the transmission parameters are placed in the 'wakeupRet.messageExt' field in a unified manner.

2)Interface declaration

void WGLaunchMiniApp(const unsigned char *userName,
                     const unsigned char *path,
                     const eMiniProgramType &type);

3)Parameter Description

Parameter Name Type Description
userName unsigned char* Fill in miniApp's original id
path unsigned char* A parameter-carrying path which can launch miniApp page; launch miniApp's homepage by default if the parameter is filled with null
type eMiniProgramType Specify the miniApp version, which is divided into Release(0), Test(1) and Preview(2) versions

4)Return Value

None

5)Demo code

    WGPlatform::GetInstance()->WGLaunchMiniApp((unsigned char*)"gh_e9f65127c15",
                                               (unsigned char*)"page/indexSelAddr/index",
                                               ProgramType_Release);

6)Special description

Starting from version 3.3.17, the callback is adjusted from OnShareNotify to OnWakeUpNotify, and the transmission parameters are placed in the 'wakeupRet.messageExt' field in a unified manner.

7)Term interpretation

None

2 Start QQ miniApp

1)Function description

You can call WGLaunchQQMiniApp interface to start QQ miniApp. you need to register WGPlatformObserver and process it through OnWakeUpNotify. The transmitted parameters are all placed in the wakeupRet.messageExt field. 3.3.21 version starts to add this interface.

2)Interface statement

void WGLaunchQQMiniApp(const unsigned char *miniProgramAppid,
                       const unsigned char *miniProgramPath,
                       const eMiniProgramType &type = ProgramType_Release);

3)Parameter description

Parameter name Type Description
miniProgramAppid unsigned char* Required; the AppId of miniApp (Note: The miniApp must be bound to the shared App in the QQ interconnection platform)
miniProgramPath unsigned char* Optional; the display path of miniApp; the homepage of miniApp will be displayed by default if this field is left blank
type eMiniProgramType Optional, the type of miniApp, the default official version (ProgramType_Release)

4)Return value

None

5)Demo code

    WGPlatform::GetInstance()->WGLaunchQQMiniApp((unsigned char*)"123456",
                                               (unsigned char*)"xxx",
                                               ProgramType_Release);

6)Special instructions

In the LSApplicationQueriesSchemes field in the info.plist file, it is needed to add mqqopensdklaunchminiapp; otherwise, QQ cannot be initiated normally.

7)Term explanation

None

Share status messages to WeChat status

1) Function description

Share status messages to WeChat status. After success, status-related information will be displayed under WeChat -> My Personal Avatar. Clicking the app name under the status can make the page automatically jump to the specified page. Version 3.3.19 starts to add this interface. This version supports sharing images to WeChat status.

2) Interface statement

void WGSendToWXStateWithPhoto(const unsigned char *stateId, const unsigned char *stateTitle, ImageParams &imageParams, const unsigned char *jumpUrl);

3) Parameter description

Parameter name Type Description
stateId unsigned char* Status ID, optional; different status IDs will display different icons
stateTitle unsigned char* Status title, optional, limited to 32 characters or less
imageParams ImageParams Image information, required; the image ratio is 9:16; the corresponding fields of this struct are different on Android and iOS. Android needs to fill in the image path: android_imagePath; iOS needs to read and fill in the image data 'ios_imageData' and image data length 'ios_imageDataLen' by itself
jumpUrl unsigned char* jump URL, required, which is the page url to jump to after clicking the source tail; the game first supports jumping to the "WeChat Game Circle" page

4) Return value

None

5) Demo code

    WGPlatform::GetInstance()->WGSendToWXStateWithPhoto((unsigned char*)"1019",(unsigned char*)"stateTitle", imageParams, (unsigned char*)"jumpUrl");

6) Special instructions

  • The above is an example of sharing image to WeChat status. Other language interfaces ​​are similar. For games, 'stateId' can be filled in with 1019. After stateTitle is set, it will be used as the default value of the edit page. 'jumpUrl' is the Game Circle address. After URL jumps to WeChat, everything except 'jumpUrl' can be modified independently.
  • If you need to access it, you need to contact MSDK Assistant for specific usage methods
  • The recommended size for an image is 9:16.
  • jumpUrl: please fill in it with the Game Circle address

7) Term explanation

None

Share videos to WeChat video account

1) Function description

Make one-click to share the video generated by the user in the game to the WeChat video account. Version 3.3.19 starts to add this interface.

2) Interface statement

void WGSendToWXChannelShareVideo(VideoParams &videoParams, const unsigned char *messageExt);

3) Parameter description

Parameter name Type Description
videoParams VideoParams Video information, required; the corresponding fields of this struct are different on Android and iOS. Android needs to fill in the video path: android_videoPath, and iOS needs to fill in the video identifier 'PHAsset localIdentifier:ios_videoLocalIdentifier' in the system album.
messageExt unsigned char* Extended field, optional, which carries additional information; currently not used in the current version

4) Return value

None

5) Demo code

    WGPlatform::GetInstance()->WGSendToWXChannelShareVideo(videoParams,(unsigned char*)"messageExt");

6) Special instructions

  • If you need to access it, you can contact MSDK Assistant for specific usage methods
  • The video format currently only supports MP4, the duration shall not exceed 30 minutes, the size shall not exceed 450M, and the aspect ratio shall be between 1: 3 and 3: 1.
  • The struct parameter 'VideoParams' involved has different corresponding fields on Android and iOS. Android needs to fill in the video path: android_videoPath, and iOS needs to fill in the video identifier 'PHAsset localIdentifier: ios_videoLocalIdentifier' in the system album.

7) Term explanation

None

WeChat Video Channel livestreaming

1)Function description

MSDK encapsulates the video channel livestreaming interface and uses the WGSendToWXChannelStartLive interface, and the input parameters are the Json string `channelLiveJosn` passed by the app and extension field `messageExt`. 3.3.26 version starts adding this interface

2)Interface statement

void WGSendToWXChannelStartLive(string channelLiveJosn, string messageExt);

3)Parameter description

Parameter name Type Description
channelLiveJosn string the Json string required for the app to initiate video channel livestreaming,Required, contact MSDK Assistant for specific usage methods
messageExt string Extended field, Optional, currently not used in the current version

4)Demo code

channelLiveJosn is the Json string required to initiate the live broadcast of the video account for the business. For details, please refer to the interface documentation:https://doc.weixin.qq.com/doc/w3_AJIAmAbDAK4LXcbbMdHT6OnjGLNvf?scode=AJEAIQdfAAoCcEODzyAJIAmAbDAK4


string channelLiveJosn = "{\"liveJsonInfo\":\"{\\\"extraAntiInfo\\\":\\\"bQ9Xn5XOTvUmrcjt3%2FOWSs4HxJRt5Nz%2FY3peUMSqoufJIVLJAWZs4nYZ9gM3SoKH\\\",\\\"routeScene\\\":3,\\\"liveEntryScene\\\":1,\\\"appid\\\":\\\"wxcde873f99466f74a\\\"}\",\"openID\":\"oGRTijm8K4JWxwe67BjsAF1t6Y7o\"}";
string messageExt = "MSDK WeChat Channel Start Live";

WGPlatform.Instance.WGSendToWXChannelStartLive(channelLiveJosn, messageExt);

Return result:


Skip to WeChat successfully, and launch WeChat Video Circle livestreaming page. MSDK has no callback in case of success.
Only when `opensdk` is abnormal will the result be returned through MsdkEvent.Instance.ShareEvent.

MsdkEvent.Instance.ShareEvent += (ShareRet ret) =>
{
    Debug.Log(ret.ToString());
    message = ret.ToString();
    if (ret.flag == eFlag.eFlag_Succ)
    {
        // Shared successfully
    }
    else
    {
        // Handle the sharing failure
    }
};

5)Special instructions

  • When `openID` passed is empty, it is set as an empty string by default
  • For the specific use method, please contact MSDK Assistant for specific usage methods

QQ Small World Share

1)Function description

MSDK encapsulates the QQ Small World Share interface and uses the WGSendToQQWithCommonShare interface, and the input parameters are `servieID` passed by the app and extension parameter `extraJson`. 3.3.26 Version starts adding this interface

2)Interface statement

void WGSendToQQWithCommonShare(string serviceID, string extraJson);

3)Parameter description

Parameter name Type Description
serviceID string service ID; each connected QQ service needs to contact QQ-Connect to assign a service ID to it
extraJson string Extensible parameter; the data can be transmitted to QQ, and the incoming content shall be agreed with the QQ

4)Demo code


string serviceID = "3004"; 
string extraJson = "{\"local_video_path\":\"\\/storage\\/emulated\\/0\\/Android\\/data\\/com.example.wegame\\/files\\/video.mp4\"}"; 

WGPlatform.Instance.WGSendToQQWithCommonShare(serviceID, extraJson);

Receive the returned result through the Share callback:


MsdkEvent.Instance.ShareEvent += (ShareRet ret) =>
{
    Debug.Log(ret.ToString());
    message = ret.ToString();
    if (ret.flag == eFlag.eFlag_Succ)
    {
        // Shared successfully
    }
    else
    {
        // Handle the sharing failure
    }
};

5)Special instructions

  • To assign service ID, please contact MSDK Assistant for specific usage methods

WeChat Native Sharing

1)Function description

MSDK to encapsulate the WeChat native sharing interface. The function uses the WGSendToWXNativeGamePage interface to share messages to WeChat sessions and WeChat Moment. This interface has been added since version 3.3.28.

2)Interface declaration

void WGPlatform::WGSendToWXNativeGamePage(const eWechatScene &scene,
                                          unsigned char *title,
                                          unsigned char *desc,
                                          unsigned char *mediaTagName,
                                          unsigned char *thumbImgData,
                                          const int &thumbImgDataLen,
                                          const bool isVideo,
                                          const int &videoDuration,
                                          unsigned char *shareData,
                                          unsigned char *messageExt,
                                          unsigned char *messageAction)

3)Parameter description

Parameter name Type Description
scene eWechatScene enumeration Identify WeChat sessions or WeChat Moment where messages are sent
title unsigned char * Title; size cannot exceed 512 bytes
desc unsigned char * Summary information; size cannot exceed 1K
mediaTagName unsigned char * This value will be passed to WeChat for statistical purposes
thumbImgData unsigned char * Thumbnail file data
thumbImgDataLen int Thumbnail data length; size cannot exceed 256K
isVideo bool Is it a video type
videoDuration int Video duration, in seconds (required for video type)
shareData unsigned char * Transmission field, whose size cannot exceed 100K
messageExt unsigned char * Game-defined transmission field, which can be filled in with an empty string if not needed
messageAction unsigned char * Reserved field, which can be filled in with an empty string

4)Return value

None; the sharing result will be returned to the game through WGPlatformObserver calling back OnShareNotify function

5)Demo code


WGPlatform::GetInstance()->WGSendToWXNativeGamePage((eWechatScene)cScene, (unsigned char *)"SendToWXNativeGamePage", (unsigned char *)"SendToWXNativeGamePage", (unsigned char *)"MSG_INVITE", (unsigned char*)thumbImgData, thumbImgDataLen, isVideo, videoDuration, (unsigned char *)shareData, (unsigned char *)"SendToWeixin_extInfo", (unsigned char *)"");

6)Warning

When using this interface, please read WeChat native sharing related documentation:https://iwiki.woa.com/p/4008426990