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
FAQ
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
FAQ
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
FAQ
Others
Data Structure
System Tools
Share / Unity3D / 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 sharing modes and sharing contents, sharing scenes are divided into structured sharing, music sharing, big image sharing, backend sharing, link sharing (unique for WeChat), mobile QQ rich sharing (unique for Android ),Mobile QQ ARK sharing, mobile QQ video sharing (unique for Android),and 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.

1 MSDK's share scenes and goals

MSDK share scene

1) 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.

2) Big image sharing

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

3) 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

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.

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.

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. It can upload multiple images (<=9 images to QZone >9 images to the album), and support gif images.

Share messages to QZone

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.

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 Assets\Example\MsdkDemo.cs script's ShowQQ().

For WeChat sharing example, refer to Assets\Example\MsdkDemo.cs script's ShowWX() method's sharing part.

3 Bind the interface with button

For how to bind the interface with the button, refer to login moduleAccess Guide Step3. An example on how to call the sharing interface is as follows:

public void ClickedShare()
{
    // after clicking the button, call MSDK's sharing interfaces
    string title = "QQ Share-title";
    string desc = "QQ Share-desc";
    string imgNetUrl = "http://qzonestyle.gtimg.cn/open_proj/proj_open_v2/ac/home/qrcode.jpg";
    string targetUrl = "http://gamecenter.qq.com/gcjump?game_tag=MSG_INVITE&plat=qq&pf=invite" +
        "&appid=100703379&from=androidqq&" + "uin=182849215&originuin=61793295&platformId=qq_m" +
        "&sid=Ac0o-208NGD3k3FNCv3J4Q4f&gamedata=gamedata";
    WGPlatform.Instance.WGSendToQQ(eQQScene.QQScene_QZone, title, desc, targetUrl, imgNetUrl, imgNetUrl.Length);
}

For different sharing interfaces' examples; refer to the code examples on the subsequent interface explanations.

4 Run and view the result

Click the triangle icon above the middle part of Unity to run the program in the PC environment, and then click the Game panel's button

First, click the "Login" button to complete the authorized login. Then, click "Share" button to complete sharing. At this time, when you view Console, you can see the following login interfaces be successfully called and see the callback log

Finally, export the installation package and install and run it in the mobile phone. After the "Login" button is clicked, mobile QQ is launched and the login authorization is completed. Then, click "Share" button to launch mobile QQ to complete sharing, so as to view the sharing effect in mobile QQ session or QZone.

5 Call this module's other interfaces

After completing Step1-Step4, 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.


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.
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.
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.
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.
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.
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.
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.
Share Messages to WeChat GameLine: The game provides image data, which can be shared WeChat GameLine through inside webview. The size of the image data can't exceed 512K now.

Structured sharing

1 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.

2 Registration callback

1)Function descriptione

To receive MSDK's sharing callback, you need to register callback event ShareEvent and handle it according to ShareRet.

2)Interface declaration
public delegate void ShareDelegate(ShareRet shareRet);
3)Parameter description
Parameter name Type Description
shareRet ShareRet class Sharing result information type
4)Return value

None

5)Demo code
MsdkEvent.Instance.ShareEvent += (ShareRet shareRet) =>
{
    switch (ret.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

3 WeChat structured sharing

1)Function descriptione

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 String title; size can't exceed 512 bytes
desc String Summary information; size can't exceed 1K
mediaTagName String This value will be passed to WeChat for statistics. Click Specification to see the details.
imgData byte[] thumbnail file data
imgDataLen int the length of thumbnail data; size can't exceed 32k
messageExt String 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, login information will be returned to the game through ShareEvent callback

5)Demo code
WGPlatform::GetInstance()->WGSendToWeixin((unsigned char *)"WeChat sharing-title", 
                                          (unsigned char *)"WeChat sharing-desc", 
                                          (unsigned char *)"MSG_INVITE", 
                                          (unsigned char *)imgData, 
                                          imgDataLen, 
                                          (unsigned char *)"message Ext"),
                                          (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 sharing. 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 WakeupEvent(WakeupRet wakeupRet). WakeupEvent's wakeupRet.messageExt is messageExt parameter passed by player A for sharing. For WakeupEvent's registration, please refer to Account inconsistency handling.

7)Term interpretation

None

4 Mobile QQ Android structured sharing

1)Function descriptione

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

2)Interface declaration
void WGSendToQQ(
    eQQScene scene,
    string title,
    string desc,
    string targetUrl,
    string imgUrl,
    int imgUrlLen,
    string tagname,
    string messageExt
);
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration flag is sent to mobile QQ session or Qzone
title String title; size can't exceed 80 byte
desc String Summary information; size can't exceed 130 bytes
targetUrl String the skip Url of the content; it is recommended its size should not exceed 120 bytes; otherwise, it will be shortened
imgUrl String shared message's thumbnail Url; local path or network Url,the image size cannot exceed 1M
imgUrlLen int shared message's thumbnail Url length
tagname String 3.3.18 version starts to add this parameter; this value can be passed to QQ for statistical use
messageExt String 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, login information will be returned to the game through ShareEvent callback

5)Demo code
string title = "QQ Share-title";
string desc = "QQ Share-desc";
string imgNetUrl = "http://qzonestyle.gtimg.cn/open_proj/proj_open_v2/ac/home/qrcode.jpg";
string targetUrl = "http://gamecenter.qq.com/gcjump?game_tag=MSG_INVITE&plat=qq&pf=invite" +
    "&appid=100703379&from=androidqq&"+"uin=182849215&originuin=61793295&platformId=qq_m" +
    "&sid=Ac0o-208NGD3k3FNCv3J4Q4f&gamedata=gamedata";
WGPlatform.Instance.WGSendToQQ (eQQScene.QQScene_QZone, title, desc, targetUrl, imgNetUrl, imgNetUrl.Length, "", "");
6)Special description

a) targetUrl If targetUrl 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

b) imgUrl When imgUrl is a local image path, the local image should be stored in a place which mobile QQ/WeChat can access, such as sdcard storage(/storage/sdcard0).

7)Term interpretation

None

5 Mobile QQ iOS structured sharing

1)Function descriptione

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

2)Interface declaration
void WGSendToQQ(
    eQQScene scene,
    string title,
    string desc,
    string targetUrl,
    byte[] imgData,
    int imgDataLen,
    string tagname,
    string messageExt
);
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration flag is sent to mobile QQ session or Qzone
title string title; the length of string can't exceed 128
desc string Summary information; the length of string can't exceed 512
targetUrl string the content's skip Url
imgData byte[] thumbnail file data,the image size cannot exceed 1M
imgDataLen int the length of thumbnail data
tagname string 3.3.18 version starts to add this parameter; this value can be passed to QQ for statistical use
messageExt string 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, login information will be returned to the game through ShareEvent callback

5)Demo code
string title = "QQ Share-title";
string desc = "QQ Share-desc";
string imgNetUrl = "http://qzonestyle.gtimg.cn/open_proj/proj_open_v2/ac/home/qrcode.jpg";
string targetUrl = "http://gamecenter.qq.com/gcjump?game_tag=MSG_INVITE&plat=qq&pf=invite&" +
    "appid=100703379&from=androidqq&"+"uin=182849215&originuin=61793295&platformId=qq_m&" +
    "sid=Ac0o-208NGD3k3FNCv3J4Q4f&gamedata=gamedata";
WGPlatform.Instance.WGSendToQQ (eQQScene.QQScene_Session, title, desc, targetUrl, imgData, imgData.Length, "", "");
6)Special description

targetUrl If targetUrl 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:
此处需要添加图片

6 Advanced usage

1) Function descriptione

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:


a) Player A opens combat room 11. At this time, player B is not online;
b) Player A shares a QQ/Wechat structured message (attached self-defined information, such as room 11 and A's openid) to B;
c) 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;
d) 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/gcjump?appid=100703379&pf=invite&from=androidqq&
plat=qq&originuin=111&ADTAG=gameobj.msg_invite

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

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

3) Demo code

Share the structured message and attach the custom information:

#if UNITY_ANDROID
WGPlatform.Instance.WGSendToQQ (eQQScene.QQScene_Session, title, desc, targetUrl, imgLocalUrl, imgLocalUrl.Length);
#else
WGPlatform.Instance.WGSendToQQ (eQQScene.QQScene_Session, title, desc, targetUrl, imgData, imgData.Length);
#endif

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

MsdkEvent.Instance.WakeupEvent += (WakeupRet ret) =>
{
    Debug.Log(ret.ToString());
    string gameCustomData = "";
    if ((int)ePlatform.ePlatform_QQ == ret.platform) {
        List<KVPair> extInfo = ret.extInfo;
        foreach(KVPair pair in extInfo) {
            if ("gamedata".Equals(pair.key)) {
                gameCustomData = pair.value;
                break;
            }
        }
    } else if ((int)ePlatform.ePlatform_Weixin == ret.platform) {
        gameCustomData = ret.messageExt;
    }
    ......
}

Big image sharing

1 General description

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

2 Registration callback

Refer to structured sharing's Registration callback

3 WeChat big image sharing-image data

1)Function descriptione

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

2)Interface declaration
void WGSendToWeixinWithPhoto(
    eWechatScene scene,
    string mediaTagName,
    byte[] imgData,
    int imgDataLen,
    string messageExt,
    string messageAction
);
3)Parameter description
Parameter name Type Description
scene eWechatScene enumeration flag is sent to WeChat session or Moments
mediaTagName String This value will be passed to WeChat for statistics. Click Specification to see the details.
imgData byte[] thumbnail file data
imgDataLen int the length of thumbnail data; size can't exceed 32k
messageExt String 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 string 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, login information will be returned to the game through ShareEvent callback

5)Demo code
string title = "WeChat share-title";
string desc = "WeChat share-desc";
string mediaTagName = "MSG_INVITE";
byte[] imgData = imgData;
int imgDataLen = imgData.Length;
string messageExt = "SendToWeixin_extInfo";
string messageAction = "WECHAT_SNS_JUMP_APP";
WGPlatform.Instance.WGSendToWeixinWithPhoto(eWechatScene.WechatScene_Session, mediaTagName, imgData, imgDataLen, messageExt, messageAction);
6)Special description

None

7)Term interpretation

None

4 WeChat Android big image sharing-image path

1)Function descriptione

In Android platform, big image sharing which uses image data may fail in some machines when the image data size is greater than 1MB. At this time, you can use WGSendToWeixinWithPhotoPath interface to share big HD images.

2)Interface declaration
void WGSendToWeixinWithPhotoPath(
    eWechatScene scene,
    string mediaTagName,
    string imgPath,
    string messageExt,
    string messageAction
);
3)Parameter description
Parameter name Type Description
scene eWechatScene enumeration flag is sent to WeChat session or Moments
mediaTagName String This value will be passed to WeChat for statistics. Click Specification to see the details.
imgPath String The local image's path; the image size can't exceed 3MB
messageExt String 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 String 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, login information will be returned to the game through ShareEvent callback

5)Demo code
string mediaTagName = "MSG_INVITE";
string imgLocalUrl = "/storage/sdcard0/test.png";
string messageExt = "SendToWeixin_extInfo";
string messageAction = "WECHAT_SNS_JUMP_APP";
WGPlatform.Instance.WGSendToWeixinWithPhotoPath(eWechatScene.WechatScene_Session, mediaTagName, imgLocalUrl, messageExt, messageAction);
6)Special description

None

7)Term interpretation

None

5 Mobile QQ Android big image sharing

1)Function descriptione

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

2)Interface declaration
void WGSendToQQWithPhoto(eQQScene scene, string imgFilePath, string tagname, string messageExt);
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration flag is sent to mobile QQ session or Qzone
imgFilePath String The local file path shared image; the backend will compress the image when the shortest edge of the image is greater than 640px
tagname String 3.3.18 version starts to add this parameter; this value can be passed to QQ for statistical use
messageExt String 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, login information will be returned to the game through ShareEvent callback

5)Demo code
string imgLocalUrl = "/storage/sdcard0/test.png";
WGPlatform.Instance.WGSendToQQWithPhoto (eQQScene.QQScene_Session, imgLocalUrl, "", "");
6)Special description

imgFilePath is the local image path. The local image should be stored at a place which mobile QQ can access, such as sdcard storage area (/storage/sdcard0).The game side should not reuse the same path. It is needed to rename the image.

7)Term interpretation

None

6 Mobile QQ iOS big image sharing

1)Function descriptione

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

2)Interface declaration
void WGSendToQQWithPhoto(
    eQQScene scene,
    byte[] imgData,
    int imgDataLen,
    string tagname, 
    string messageExt
);
3)Parameter description
Parameter name Type Description
scene eQQScene enumeration flag is sent to mobile QQ session or Qzone
imgData byte[] thumbnail file data
imgDataLen int the length of thumbnail data
tagname String 3.3.18 version starts to add this parameter; this value can be passed to QQ for statistical use
messageExt String 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, login information will be returned to the game through ShareEvent callback

5)Demo code
byte[] imgData = imgData;
int imgDataLen = imgData.Length;
WGPlatform.Instance.WGSendToQQWithPhoto(eQQScene.QQScene_Session,imgData, imgDataLen, "", "");
6)Special description

None

7)Term interpretation

None

Mobile QQ Android 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

Note that if you are using the Android java interface, the corresponding function is WGSendToQQWithPhoto(eQQScene scene, String imgFilePath, String extraScene, String messageExt), in which imgFilePath is filled in with the image path

7)Term interpretation

None

Backend sharing

1 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.

2 Registration callback

Refer to structured sharing's Registration callback

3 Mobile QQ backend sharing

1)Function descriptione

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,
    string fOpenid,
    string title,
    string desc,
    string targetUrl,
    string imgUrl,
    string previewText,
    string gameTag,
    string msdkExtInfo
);
3)Parameter description
Parameter name Type Description
act int the action to click to share messages; 1: launch the game; the action is now configured as launching the game in a unified manner
fOpenId String the target player's openid
title String title; size can't exceed 80 byte
desc String Summary information; size can't exceed 130 bytes
targetUrl string the Game Center's details page address; for configuration, please refer to:https://wiki.ssl.msdk.qq.com/zh_EN/Unity/share.html#Unity_QGameCenter
imageUrl String shared thumbnail Url; only network image Url
previewText String preview text, optional, whose size can't exceed 45 bytes
gameTag String 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
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 ShareEvent callback.

5)Demo code
string openid = "D51F963BA3E2571ABD8244D95F9B9AD0";
string title = "QQ Share-title";
string desc = "QQ Share-desc";
string previewText = "";
string gameTag = "MSG_FRIEND_EXCEED";
string msdkExtInfo = "msdkExtInfo";
string imgNetUrl = "http://qzonestyle.gtimg.cn/open_proj/proj_open_v2/ac/home/qrcode.jpg";
string targetUrl = "http://gamecenter.qq.com/gcjump?game_tag=MSG_INVITE&plat=qq&pf=invite&" +
    "appid=100703379&from=androidqq&"+"uin=182849215&originuin=61793295&platformId=qq_m&" +
    "sid=Ac0o-208NGD3k3FNCv3J4Q4f&gamedata=gamedata";
WGPlatform.Instance.WGSendToQQGameFriend (1, openid, title, desc, targetUrl, imgNetUrl, previewText, gameTag, msdkExtInfo);
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

1 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 ShareEvent.

2 Registration callback

Refer to structured sharing's Registration callback

3 The backend shares messages to WeChat group

1)Function descriptione

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(
    int msgType,
    int subType,
    string unionid,
    string title,
    string description,
    string messageExt,
    string mediaTagName,
    string imgUrl,
    string 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 string guild ID
title string the shared content's title
description string the shared content's introduction
messageExt String 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.
mediaTagName String This value will be passed to WeChat for statistics. Click Specification to see the details.
imgUrl string shared thumbnail URL
msdkExtInfo string 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 ShareEvent callback

5)Demo code
string unionId = "110";
string title = "WX Share-title";
string desc = "WX Share-desc";
string messageExt = "messageExt";
string mediaTagName = "MSG_INVITE";
string imgNetUrl = "http://qzonestyle.gtimg.cn/open_proj/proj_open_v2/ac/home/qrcode.jpg";
string msdkExtInfo = "msdkExtInfo";

WGPlatform.Instance.WGSendToWXGroup(1, 1, unionId, title, desc, messageExt, mediaTagName, imgNetUrl, msdkExtInfo);
6)Special description

a) The interface needs to refer to guild id, so you must bind the guild to WeChat group before you can share messages. b) 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

1 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.

2 Registration callback

Refer to structured sharing's Registration callback

3 WeChat music sharing

1)Function descriptione

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

2)Interface declaration
void WGSendToWeixinWithMusic(
    eWechatScene scene,
    string title,
    string desc,
    string musicUrl,
    string musicDataUrl,
    string mediaTagName,
    byte[] imgData,
    int imgDataLen,
    string messageExt,
    string messageAction
);
3)Parameter description
Parameter name Type Description
scene eWechatScene enumeration flag is sent to WeChat session or Moments
title String title; size can't exceed 512 bytes
desc String Summary information; size can't exceed 1K
musicUrl String Skip Url after the message is clicked; its length can't exceed 10K
musicDataUrl String Music data Url (such as http://***.mp3); its length can't exceed 10K
mediaTagName String This value will be passed to WeChat for statistics. Click Specification to see the details.
imgData byte[] thumbnail file data
imgDataLen int the length of thumbnail data; size can't exceed 32k
messageExt String 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.
messageAction String 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, login information will be returned to the game through ShareEvent callback

5)Demo code
string title = "WX Share-title";
string desc = "WX Share-desc";
string mediaTagName = "MSG_INVITE";
string messageExt = "messageExt";
string messageAction = "WECHAT_SNS_JUMP_URL";
string musicUrl = "http://y.qq.com/i/song.html?songid=1135734&source=qq";
string musicDataUrl = "http://wiki.dev.4g.qq.com/v2/cry.mp3";
WGPlatform.Instance.WGSendToWeixinWithMusic(eWechatScene.WechatScene_Session, title, desc, musicUrl, musicDataUrl, mediaTagName, imgData, imgData.Length, messageExt, messageAction);
6)Special description

None

7)Term interpretation

None

4 Mobile QQ music sharing

1)Function descriptione

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

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

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

5)Demo code
string title = "QQ Share-title";
string desc = "QQ Share-desc";
string imgNetUrl = "http://qzonestyle.gtimg.cn/open_proj/proj_open_v2/ac/home/qrcode.jpg";
string musicUrl = "http://y.qq.com/i/song.html?songid=1135734&source=qq";
string musicDataUrl = "http://wiki.dev.4g.qq.com/v2/cry.mp3";
WGPlatform.Instance.WGSendToQQWithMusic(eQQScene.QQScene_QZone,title, desc, musicUrl, musicDataUrl, imgNetUrl);
6)Special description

When imgUrl is the local image path, the local image should be stored at a place which mobile QQ can access, such as sdcard storage area (/storage/sdcard0)

7)Term interpretation

None

WeChat link sharing

1 General description

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

2 Registration callback

Refer to structured sharing's Registration callback

3 WeChat link sharing

1)Function descriptione

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 String title; size can't exceed 512 bytes
desc String Summary information; size can't exceed 1K
url String Click the destination URL which can be opened; its length can't exceed 10K
mediaTagName String This value will be passed to WeChat for statistics. Click Specification to see the details.
imgData byte[] thumbnail file data
imgDataLen int the length of thumbnail data; size can't exceed 32k
messageExt String 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.
userOpenId unsigned char* Specify to share messages to a specific friend; this parameter can pass an empty string; 3.3.0 version started to create the parameter
4)Return value

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

5)Demo code
WGPlatform::GetInstance()->WGSendToWeixinWithUrl((eWechatScene)cScene, 
                                                 (unsigned char *)"WeChat sharing-title",
                                                 (unsigned char *)"WeChat sharing-desc", 
                                                 (unsigned char *)"http://www.qq.com", 
                                                 (unsigned char *)"MSG_INVITE",
                                                 (unsigned char *)cImgData, 
                                                 cImgDataLen, 
                                                 (unsigned char *)"messageExt",
                                                 (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 video sharing

1 General description

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

2 Registration callback

Refer to structured sharing's Registration callback

3 Mobile QQ video sharing

1)Function descriptione

You can call WGSendToQQWithVideo interface to launch mobile QQ to share video messages to QZone.

2)Interface declaration
void WGSendToQQWithVideo(string summary, string videoPath);
3)Parameter description
Parameter name Type Description
summary String the shared content's text; the parameter is now invalid
videoPath String the shared video's path; only support local videos; mobile QQ client version needs to be greater than or equal to 5.9.5
4)Return value

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

5)Demo code
string summary = "My wonderful gaming moments";
string myVideo = "/storage/sdcard0/cry.mp4";
WGPlatform.Instance.WGSendToQQWithVideo(summary, myVideo);
6)Special description

videoPath represents that local videos should be stored at a place which mobile QQ can access, such as sdcard storage area (/storage/sdcard0)

7)Term 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 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

1 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:

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;

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

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:

MsdkEvent.Instance.WakeupEvent += (WakeupRet ret) =>
{
    // TODO GAME
    string gamedata;
    List<KVPair> pairs = ret.extInfo;
    foreach(KVPair pair in pairs)  
    {
        if (pair.key.Equals("gamedata"))
        {
            gamedata = pair.value;
        }
    }
}

Wherein, for WakeupEvent's registration, please refer to Account inconsistency handling.

Share messages to WeChat GameLine (2.17.0 and higher versions)

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(byte[] data, string gameExtra);

3)Parameter description

Parameter name Type Description
data byte[] Shared image data
gameExtra String A parameter defined the game itself for sharing; the parameter will be appended behind url

4)Return value

Without callback.

5)Demo code

byte[] data = new byte[]{0} //image data 
WGPlatform.Instance.WGShareToWXGameline(data,"Parameter");

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

7)Name 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(string link);

3)Parameter description

Parameter name Type Description
link String 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.Instance.WGOpenWeiXinDeeplink("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(string miniProgramAppid,
                       string miniProgramPath,
                       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* unsigned char*
type eMiniProgramType Optional, the type of miniApp, the default official version (ProgramType_Release)

4)Return value

None

5)Demo code

   WWGPlatform.Instance.WGLaunchQQMiniApp("123456","xxx",ProgramType_Release);

6)Special instructions

iOS 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 WGSendToWXNativeGamePage(eWechatScene scene, 
															string title, 
															string desc, 
															string mediaTagName, 
															byte[] thumbImgData, 
															int thumbImgDataLen,
															bool isVideo, 
															int videoDuration, 
															string shareData, 
															string messageExt, 
															string messageAction)

3)Parameter description

Parameter name Type Description
scene eWechatScene enumeration Identify WeChat sessions or WeChat Moment where messages are sent
title string Title; size cannot exceed 512 bytes
desc string Summary information; size cannot exceed 1K
mediaTagName string This value will be passed to WeChat for statistical purposes
thumbImgData byte[] 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 string Transmission field, whose size cannot exceed 100K
messageExt string Game-defined transmission field, which can be filled in with an empty string if not needed
messageAction string 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



tring title = "SendToWXNativeGamePage";
string desc = "SendToWXNativeGamePage";
string mediaTagName = "MSG_INVITE";
byte[] thumbImgData = thumbImgData;
int thumbImgDataLen = thumbImgData.Length;
string messageExt = "";
string messageAction = "";

WGPlatform.Instance.WGSendToWXNativeGamePage(eWechatScene.WechatScene_Session, title, desc, mediaTagName, thumbImgData, thumbImgDataLen, true, videoDuration, shareData, messageExt, messageAction);

6)Warning

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