Personal infomation
Unity3D
Outline
Access Guide
Query personal information
Query friends' information
Add QQ friends
FAQ
Android
Outline
Access Guide
Query personal information
Query friends' information
Add QQ friends
FAQ
IOS
Outline
Access Guide
Query personal information
Query friends' information
Add QQ friends
FAQ
Others
Data Structure
System Tools
Personal infomation / Android / Outline

Outline

The relation chain module is an information query service which is provided by MSDK and is based on mobile QQ and WeChat friends' relations. The relation chain module provides the following functions:

1)Query personal information (PersonInfo):nickname, openId, small avatar 40x40 (pictureSmall), mid-sized avatar 60x60 (pictureMiddle), large avatar 100x100 (pictureLarge)

Note: Due to the restriction of mobile QQ, avatar returns only two sizes 40x40 and 100x100, and the setting of mobile QQ is that mi-sized avatar also returns 40x40

2)Query friends' information:only support to query the information of friends who have played the current game. The detailed information of each friend is the same with his or her personal detailed information (PersonInfo)

3)Add QQ friends:You can complete the function of adding friends in the game through the interfaceAdd QQ friends

You can use the function of querying personal information and querying friends' information in the following scenes:

4) Game leaderboard (take the friends leaderboard of "Sword Heroes Fate" as an example)

QQ friends leaderboard calling interface: WGQueryQQGameFriendsInfo

Function 1: Call WGQueryQQGameFriendsInfo to get the data of QQ game friends

Function 2: Gift: which is a backend sharing function. Its feature is to be able to directly share messages to friends through the server without launching mobile QQ. For details, you can refer to the Share Module's "mobile QQ backend sharing"

Function 3: game entrance for mobile QQ game friends

Function 4: invite friends: which is a sharing function to share messages to QQ session. For details, please refer to the Share Module's "QQ structured sharing"

WeChat friends leaderboard calling interface: WGQueryWXGameFriendsInfo

Function 1: Call WGQueryWXGameFriendsInfo to get the data of WeChat game friends

Function 2: Gift: which is a backend sharing function. Its feature is to be able to directly share messages to friends through the server without launching WeChat. For details, please refer to the Share Module's "WeChat backend sharing"

Function 3: game entrance for WeChat game friends

Function 4: invite friends: which is a sharing function to share messages to WeChat session. For details, please refer to the Share Module's " WeChat structured sharing"

5)Add qq friends

Access Guide

1 Preconditions

1)You have completed initialization according to the initialization module's description initialization

2)Confirm that the user has completed mobile QQ/WeChat authorized login

2 Refer to demos

1) For mobile QQ personal information examples, please refer to com\example\module\submodule\Example\QQModule.java   file's callWGQueryQQUserInfo() method.

2)For mobile QQ friends examples, refer to com\example\module\submodule\Example\QQModule.java file's callWGQueryQQGameFriendsInfo() method.

3) For WeChat personal information examples, please refer to com\example\module\submodule\Example\WXModule.java file's callWGQueryWXUserInfo() method.

4) For WeChat friends examples, please refer to com\example\module\submodule\Example\WXModule.java file's callWGQueryWXGameFriendsInfo() method.

Query personal information

1. General description

1) Mobile QQ user (WGQueryQQMyInfo): After the user is authorized via mobile QQ, the game requires the user's nickname, avatar and other information and can call WGQueryQQMyInfo to get the user's personal information, including: nickname, openId, small avatar (PictureSmall), mid-sized avatar (pictureMiddle), and large avatar (pictureLarge).

2)After the WeChat user (WGQueryWXMyInfo) has been authorized for use of WeChat, the game needs the user information like nickname and picture. WGQueryWXMyInfo may be called. Here, personal information includes: nickname(nickname), OpenId( openId), small picture(pictureSmall), middle picture(pictureMiddle), large picture(pictureLarge).

2. Registration callback

1)Function description

In order to receive msdk's relation chain callback, the game needs to register callback function for processing. It is recommended to register it in the game's onCreate function

2)Interface declaration
public static void WGSetObserver(WGPlatformObserver observer) 
3)Parameter description
Parameter name Type Description
observer WGPlatformObserver class MSDK callback class, please refer to the demo code
4)Return value

None, handle it in callback OnRelationNotify function

return value name type description
relationRet RelationRet relation chain struct
5)Demo code
WGPlatform.WGSetObserver(new WGPlatformObserver() {

            @Override
            public void OnWakeupNotify(WakeupRet ret) {
                // TODO Auto-generated method stub

            }

            @Override
            public void OnShareNotify(ShareRet ret) {
                // TODO Auto-generated method stub

            }

            @Override
            public void OnRelationNotify(RelationRet relationRet) {
                if (relationRet.flag == CallbackFlag.eFlag_Succ) {
                    // Query the relation chain successfully
                    switch(relationRet.type){
                    case eRet_QueryMyInfo:
                        // personal information
                        break;
                    case eRet_QueryGameFriends:
                        // Friend's information
                        break;
                    }

                } else {
                    // Query the relation chain unsuccessfully
                }



            }

            @Override
            public void OnLoginNotify(LoginRet ret) {
                // TODO Auto-generated method stub

            }

            @Override
            public void OnLocationNotify(RelationRet relationRet) {
                // TODO Auto-generated method stub

            }

            @Override
            public void OnLocationGotNotify(LocationRet locationRet) {
                // TODO Auto-generated method stub

            }

            @Override
            public void OnFeedbackNotify(int flag, String desc) {
                // TODO Auto-generated method stub

            }

            @Override
            public String OnCrashExtMessageNotify() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public byte[] OnCrashExtDataNotify() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public void OnAddWXCardNotify(CardRet ret) {
                // TODO Auto-generated method stub

            }
        });
6)Special description

None

7)Name interpretation

None

3、Call interfaces

1)Function description

The game can query the personal information by calling WGQueryQQMyInfo/WGQueryWXMyInfo interface, so as to get nickname(nickname), OpenId( openId), small avatar 40x40(pictureSmall), mid-sized avatar 60x60(pictureMiddle), large avatar 100x100(pictureLarge)

2)Interface declaration
public static Viod WGQueryQQMyInfo();
public static Viod WGQueryWXMyInfo();
3)Parameter description

None

4)Return value

None, the result is called back through OnRelationNotify. As for callback settings, please refer to Registration Callback

5)Demo code
WGPlatform.WGQueryQQMyInfo(); // query mobile QQ user's personal information
WGPlatform.WGQueryWXMyInfo(); // query WeChat user's personal information
6)Special description

The personal information doesn't contain OpenId information. If you need OpenId information, you can get it through the login module's token-getting interface WGGetLoginRecord.

7)Name interpretation

None

Query game friends' information

1. General description

1)Mobile QQ user (WGQueryQQGameFriendsInfo) After the user gets authorization through mobile QQ, the user can get friends' information (such as friends' score leaderboard ) in the game through WGQueryQQGameFriendsInfo. As for friends' information, please refer to the personal information

2)WeChat user (WGQueryWXGameFriendsInfo) After the user gets authorization through WeChat, the user can get friends' information (such as friends' score leaderboard ) in the game through WGQueryWXGameFriendsInfo. As for friends' information, please refer to the personal information

2. Registration callback

This interface and the personal information query interface use the same callback. If the callback has been set, it is not needed to repeat setting it. If the callback is not set, please view Callback Settings. RelationRet object's persons attribute is a List, in which each PersonInfo object is a friend's information. A friend's information includes: nickname, openId, small avatar 40x40(pictureSmall), mid-sized avatar 60x60(pictureMiddle), large avatar 100x100(pictureLarge). 

3、Call interfaces

1)Function description

The game can query and get the information of friends playing the current game through CallWGQueryQQGameFriendsInfo/WGQueryWXGameFriendsInfo interface: nickname, openId, small avatar 40x40 (pictureSmall), mid-sized avatar 60x60 (pictureMiddle), large avatar 100x100 (pictureLarge).

2)Interface declaration
public static Void WGQueryQQGameFriendsInfo();
public static Void WGQueryWXGameFriendsInfo();
3)Parameter description

None

4)Return value

None, the result is called back through OnRelationNotify. As for callback settings, please refer to Registration Callback

5)Demo code
WGPlatform.WGQueryQQGameFriendsInfo(); // query the information about mobile QQ user's game friends
WGPlatform.WGQueryWXGameFriendsInfo(); // query the information about WeChat user's game friends
6)Special description

1)In order to prevent the failure of getting the personal information (such as avatar, name), friends' information (such as avatar, name) from resulting in the failure of logging in the game, please set querying the personal information and querying friends' information as the non-critical path.

2)In mobile QQ, the result of querying game friends' does not contain the user's own information; but in WeChat, the result contains the user's own information.

3)V3.3.21 version starts adding the user's unauthorized error codes in the relationship callback interface;if the user does not authorize the relationship permission, then relationRet.flag = eFlag_UnPermission (-9) in the callback interface OnRelationNotify.

4)Starting from version V3.3.28 `WGQueryWXGameFriendsInfo` the client interface of WeChat in-game friend information retrieval function, adds returning the `friendRemark` (remark name) field.

The test environment and release environment of MSDK V3 are compatible with the old scheme by default (`nickname` gives priority to using WeChat friend remarks and does not return the `friendRemark` field). If the game needs to switch to the new scheme (`nickname` corresponds to WeChat nickname, and `friendRemark` corresponds to WeChat in-game friend remarks), it needs to contact MSDK to update the configuration for the game to enable the new scheme.

7)Name interpretation

Game friends: players who are playing the current game 

Non-critical path: refer to a saying of not affecting the game's login process; msdk defines mobile QQ\WeChat's login process as the critical path. Once the login process is interrupted, this will cause a serious impact on the normal operation of the game.

Add QQ friends

1)General description

The player may directly add (Pull mobile QQ) game player into QQ friends during the game (in case of multiple clicks, multiple pieces of QQ adding applications will not be sent).

2)Registration callback

None

3)Call interfaces

1)Function description

Players can directly add other players as QQ friends in the game.

2)Interface declaration
public static void WGAddGameFriendToQQ(string fopenid, string desc, string message);
3)Parameter description
Parameter name Type Description
fopenid string to-be-added friend's openid
desc string to-be-added friend's remarks
message string authentication information sent when adding a friend
4)Return value

None

5)Demo code
string openID = "44386ABB2C583E72CF436D3FAD31B323";
WGPlatform.WGAddGameFriendToQQ (openID, "Broken kite", "Hello, I am a player of the King of Glory: Mr. Liu");
6)Special description

None

7)Name interpretation

None