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.
1 MSDK's share scenes and goals
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.
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.
1) WeChat's backend sharing message is displayed in friends' sessions.
2)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.
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 access configuration by the instructions for accessing the configuration module.
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/src/com/example/module/submodule/QQModule.java.
For examples of WeChat sharing, please refer to the Share section in MSDKDemo/src/com/example/module/submodule/WXModule.java.
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.
10)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.
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 description
In order to receive a share callback from MSDK, you need to register WGPlatformObserver and handle it with OnShareNotify.
2)Interface declaration
public static void WGSetObserver(WGPlatformObserver observer);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
observer | WGPlatformObserver class | MSDKMSDK callback class, please refer to the demo code |
4)Return value
None
5)Demo code
public class MsdkCallback implements WGPlatformObserver {
public void OnShareNotify(ShareRet ret) {
Logger.d("called");
String result = "";
switch (ret.flag) {
case CallbackFlag.eFlag_Succ:
// Sharing is successful
result = "Share success\n" + ret.toString();
break;
case CallbackFlag.eFlag_QQ_UserCancel:
case CallbackFlag.eFlag_WX_UserCancel:
case CallbackFlag.eFlag_WX_NotInstall:
case CallbackFlag.eFlag_WX_NotSupportApi:
default:
// Sharing is unsuccessful and processed
Logger.d(ret.desc);
result = "Share faild: \n" + ret.toString();
break;
}
// Send the result to the result display page
sendResult(result);
}
}
6)Special description
None
7)Name interpretation
None
3 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
);
Parameter name | Type | Description |
---|---|---|
title | unsigned char * | title; size can't exceed 512 bytes |
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. |
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 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 WGPlatformObserver's callback function OnShareNotify
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
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 OnWakeupNotify (WakeupRet wakeupRet). OnWakeupNotify's wakeupRet.messageExt is messageExt parameter passed by player A for sharing. For OnWakeupNotify's registration, please refer to Account inconsistency handling.
7)Name interpretation
None
4 Mobile QQ Android structured sharing
1)Function description
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(const eQQScene &scene,
unsigned char *title,
unsigned char *desc,
unsigned char *targetUrl,
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; size can't exceed 80 byte |
desc | unsigned char * | Summary information; size can't exceed 130 bytes |
targetUrl | unsigned char * | the skip Url of the content; it is recommended its size should not exceed 120 bytes; otherwise, it will be shortened |
imgUrl | unsigned char * | 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 | 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 WGPlatformObserver's callback function OnShareNotify
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
-
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.
-
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)Name interpretation
None
8)
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:
- 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.
- 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:
此处需要添加图片
5 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:
- Player A opens combat room 11. At this time, player B is not online;
- Player A shares a QQ/Wechat structured message (attached self-defined information, such as room 11 and A's openid) to B;
- 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;
- 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:
WGPlatform.WGSendToQQ (eQQScene.QQScene_Session, title, desc, targetUrl, imgLocalUrl, imgLocalUrl.Length);
Click the shared message to start, receive and process the attached custom information:
public class MsdkCallback implements WGPlatformObserver {
public void OnWakeupNotify(WakeupRet ret) {
//ret.extInfo stores information passed from all platforms
}
}
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 description
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'sSpecial description;If you don't need it, you can fill in an empty string. |
" | messageAction | String |
4)Return value
None, the sharing result is returned to the game through WGPlatformObserver's callback function OnShareNotify
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.WGSendToWeixinWithPhoto(eWechatScene.WechatScene_Session, mediaTagName, imgData, imgDataLen, messageExt, messageAction);
6)Special description
None
7)Name interpretation
None
4 WeChat Android big image sharing-image path
1)Function description
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, the sharing result is returned to the game through WGPlatformObserver's callback function OnShareNotify.
5)Demo code
String mediaTagName = "MSG_INVITE";
String imgLocalUrl = "/storage/sdcard0/test.png";
String messageExt = "SendToWeixin_extInfo";
String messageAction = "WECHAT_SNS_JUMP_APP";
WGPlatform.WGSendToWeixinWithPhotoPath(eWechatScene.WechatScene_Session, mediaTagName, imgLocalUrl, messageExt, messageAction);
6)Special description
None
7)Name interpretation
None
5 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 *imgFilePath,
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 |
imgFilePath | unsigned char * | The local file path shared image; the backend will compress the image when the shortest edge of the image is greater than 640px |
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 WGPlatformObserver's callback function OnShareNotify.
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
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)Name 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 for Android and iOS, respectively. Android needs to fill in the picture path: android_imagePath. |
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
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 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,
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 field is configured as the Game Center's details page address in a unified manner; for details for the configuration, please refer to: https://wiki.ssl.msdk.qq.com/zh_EN/Android/share.html#Android_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 WGPlatformObserver 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.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)Name 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 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(
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.WGSendToWXGroup(1, 1, unionId, title, desc, messageExt, mediaTagName, imgNetUrl, msdkExtInfo);
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)Name interpretation
None
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 description
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 byte |
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 WGPlatformObserver 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.WGSendToWeixinWithMusic(eWechatScene.WechatScene_Session, title, desc, musicUrl, musicDataUrl, mediaTagName, imgData, imgData.Length, messageExt, messageAction);
6)Special description
None
7)Name interpretation
None
4 Mobile QQ music sharing
1)Function description
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 WGPlatformObserver 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.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)Name interpretation
None
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 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 | 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 WGPlatformObserver 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)Name interpretation
None
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
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 description
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 | Shared video's path; only support local videos and require that the mobile QQ client version be greater than or equal to 5.9.5; its size can't exceed 1w bytes |
4)Return value
None, login information will be returned to the game through WGPlatformObserver callback
5)Demo code
String summary = "My wonderful gaming moments";
String myVideo = "/storage/sdcard0/cry.mp4";
WGPlatform.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)Name interpretation
None
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 Android 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:
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 |
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:
public void OnWakeupNotify(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 OnWakeupNotify's registration, please refer to Account inconsistency handling.
1)Function descriptione
Allow users to open WeChat GameLine through inside webview to share images and texts to WeChat GameLine.
2)Interface declaration
public static void WGShareToWXGameline(final 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.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.0a.
2)Interface declaration
public static 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.WGOpenWeiXinDeeplink("INDEX");
6)Special description
-
For DeepLink function, it is needed to contact WeChat Game Center to open and configure it.
-
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
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
None
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
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
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 *)"");