CallbackRet
public abstract class CallbackRet{
public int flag=eFlag.eFlag_Error;//result
public String desc="";
public int platform=0;//platform type
}
LoginRet
Store the information gotten after the user logs in the game
public class LoginRet extends CallbackRet{
public String open_id=""; //the user account's unique identifier
public String user_id=""; //the user's ID; reserved; the game doesn't need to care about it
public String pf=""; //used for payment call WGGetPf()to get it
public String pf_key=""; //used for payment call WGGetPfKey()to get it
public String prajna_ext; //New fields for 3.3.7
public Vector<TokenRet> token=new Vector<TokenRet>(); //store the token list
}
TokenRet
Token information
public class TokenRet{
public int type=0; //token type eTokenType type
public String value=""; //token value
public long expiration=0; //token expiration time (the game doesn't need to care about it)
eTokenType
token Type
typedef enum _eTokenType{
eToken_QQ_Access=1, // mobile QQ accessToken
eToken_QQ_Pay, // mobile QQ payToken
eToken_WX_Access, // WeChat accessToken
eToken_WX_Code, // WeChat code, already discarded
eToken_WX_Refresh, // WeChat refreshToken
eToken_Guest_Access // token in the Guest pattern
}eTokenType;
platform | token type | token use | type | valid period | |
---|---|---|---|---|---|
mobile QQ | accesstoken | query mobile QQ user, friends, relation chain, share and other functions | eToken_QQ_Access | 90 days | |
mobile QQ | paytoken | pay-related | eToken_QQ_Pay | 7 days | |
accesstoken | query WeChat user, friends, relation chain, share, payment, etc. | eToken_WX_Access | 2 hours | ||
refreshtoken | refresh accesstoken | eToken_WX_Refresh | 30 days |
WakeupRet
Store the information passed from the platform to the client when the game is awakened by the platform
public class WakeupRet extends CallbackRet{
/** Passed openid */
public String open_id="";
/** Correspond to mediaTagName in WeChat message */
public String media_tag_name="";
/** extended message, which is brought to the game when the game is evoked */
public String messageExt="";
/** language currently available only for versions higher than WeChat 5.1 and not for mobile QQ */
public String lang="";
/** country currently available only for versions higher than WeChat 5.1 and not for mobile QQ */
public String country="";
public Vector<KVPair> extInfo=new Vector<KVPair>();
...
}
LocationRet
Geographical position information
public class LocationRet extends CallbackRet{
public double longitude;
public double latitude;
...
}
RelationRet
Relation chain information, that is, "a group of" friends' information
public class RelationRet extends CallbackRet {
public Vector<PersonInfo> persons=new Vector<PersonInfo>();
public String toString() {
String str="";
if (this != null && this.persons != null) {
str=super.toString();
str=str + "friends(num): " + this.persons.size() + ";";
} else {
str="friends(num): 0;";
}
return str;
}
}
PersonInfo
Friend's information
public class PersonInfo{
public String nickName="";
public String openId="";
public String gender="";
public String pictureSmall="";
public String pictureMiddle="";
public String pictureLarge="";
public String province="";
public String city="";
public String gpsCity="";
public float distance=0;
public bool isFriend=false;
public long timestamp=0;
public String lang="";
public String country="";
}
Shared information
public class ShareRet extends CallbackRet{
public String extInfo="";
...
}
GroupRet
Group information
public class GroupRet extends CallbackRet{
public int errorCode=0;
public QQGroupInfo mQQGroupInfo ;
public WXGroupInfo mWXGroupInfo ;
...
}
QQGroupInfo
QQ group information
public class QQGroupInfo{
public String groupName=""; /*group name */
public String fingerMemo="";/*the group's brief introduction */
public String memberNum=""; /*number of group members */
public String maxNum=""; /*The maximum number of members that the group can accommodate */
public String ownerOpenid=""; /*group leader's openid */
public String unionid=""; /*Guild ID bound with the QQ group */
public String zoneid=""; /*Zone ID */
public String adminOpenids=""; /*Administrator's openid. If there are multiple administrators, use "," to separate them, for example, 0000000000000000000000002329FBEF,0000000000000000000000002329FAFF */
public String groupOpenid=""; /*groupOpenid of the QQ group bound with the game guild ID */
public String groupKey=""; /*the corresponding key of the QQ group needing to add */
}
WXGroupInfo
WeChat group information
public class WXGroupInfo{
public String openIdList=""; /* group member's openID */
public String memberNum=""; /* number of group members */
public String chatRoomURL=""; /*such as group chat UR */
}
eFlag
Login return code
public class eFlag{
public const int eFlag_Succ=0;
/** QQ&QZone login fail and can't get accesstoken */
public const int eFlag_QQ_NoAcessToken=1000;
/** QQ&QZone user has cancelled login process */
public const int eFlag_QQ_UserCancel=1001;
/** QQ&QZone login fail (tencentDidNotLogin) */
public const int eFlag_QQ_LoginFail=1002;
/** QQ&QZone networkErr */
public const int eFlag_QQ_NetworkErr=1003;
/** QQ is not install */
public const int eFlag_QQ_NotInstall=1004;
/** QQ don't support open api */
public const int eFlag_QQ_NotSupportApi=1005;
/** QQ&QZone networkErr */
public const int eFlag_QQ_AccessTokenExpired=1006;
/** pay token expiration time */
public const int eFlag_QQ_PayTokenExpired=1007;
/** Weixin is not installed */
public const int eFlag_WX_NotInstall=2000;
/** Weixin don't support api */
public const int eFlag_WX_NotSupportApi=2001;
/** Weixin user has cancelled */
public const int eFlag_WX_UserCancel=2002;
/** Weixin User has denys */
public const int eFlag_WX_UserDeny=2003;
public const int eFlag_WX_LoginFail=2004;
/** Weixin (WeChat) refreshes the token successfully */
public const int eFlag_WX_RefreshTokenSucc=2005;
/** Weixin (WeChat) refreshes the token unsuccessfully */
public const int eFlag_WX_RefreshTokenFail=2006;
/** Weixin accessToken expires; try to use refreshtoken to refresh the token */
public const int eFlag_WX_AccessTokenExpired=2007;
/** Weixin refresh also expires */
public const int eFlag_WX_RefreshTokenExpired=2008;
public const int eFlag_Error=-1;
/** Automatic login fails; need to reauthorize; errors include the local token expiration, refresh failure and other errors */
public const int eFlag_Local_Invalid=-2;
/** not in the white list */
public const int eFlag_NotInWhiteList=-3;
/** need to guide the user to open the location-based service(LBS) */
public const int eFlag_LbsNeedOpenLocationService=-4;
/** Position fails */
public const int eFlag_LbsLocateFail=-5;
/** Positioning failed The positioning switch is not turned on */
public const int eFlag_LbsNeedOpenLocationSwitch=-6;
/** The user has not authorized the relationship chain permission */
public const int eFlag_UnPermission=-9;
/** Positioning timeout */
public const int eFlag_LbsLocateTimeout=-11;
/** Quick login-related return value */
/**need to enter the login page */
public const int eFlag_NeedLogin=3001;
/**Use URL to log in successfully */
public const int eFlag_UrlLogin=3002;
/**Need to pop up the account inconsistency prompt */
public const int eFlag_NeedSelectAccount=3003;
/**Refresh token via the URL */
public const int eFlag_AccountRefresh=3004;
/*Add the logic that is checking tokens */
public const int eFlag_Checking_Token=5001;
/**Under logging in now. Please wait for login callback before operation */
public const int eFlag_Logining=5002;
/**Under logging in now. Please wait for login callback before operation */
public const int eFlag_Login_Timeout=5003;
/**Call interfaces too frequently */
public const int eFlag_RequestTooFrequently=5004;
/**built-in browser closed */
public const int eFlag_WebviewClosed=6001;
/**The url for opening the account cancellation page is invalid */
public const int eFlag_Invalid_Delete_Account_URL=6002;
/**In case of the account cancellation operation, the account is not logged in or the login channel does not support the operation */
public const int eFlag_Invalid_Login_Channel=6003;
/**The event that webview js passes parameters to native */
public const int eFlag_Webview_page_event=7000;
/** This feature is not available under Guest pattern */
public const int eFlag_InvalidOnGuest=-7;
/** Guest's token is invalid */
public const int eFlag_Guest_AccessTokenInvalid=4001;
/** Login in the Guest pattern fails */
public const int eFlag_Guest_LoginFailed=4002;
/** Registration in the Guest pattern fails */
public const int eFlag_Guest_RegisterFailed=4003;
}
Mobile QQ related:
return code | name | description | recommended handling method |
---|---|---|---|
1000 | eFlag_QQ_NoAcessToken | mobile QQ login fails; not get accesstoken | return to the login page, and guide the player to get the login authorization again |
1001 | eFlag_QQ_UserCancel | the player cancels mobile QQ-authorized login | return to the login page, and notify that the player has cancelled mobile QQ-authorized login |
1002 | eFlag_QQ_LoginFail | mobile QQ login fails | return to the login page, and guide the player to get the login authorization again |
1003 | eFlag_QQ_NetworkErr | network error | retry |
1004 | eFlag_QQ_NotInstall | the player's device doesn't install mobile QQ client | guide the player to install mobile QQ client |
1005 | eFlag_QQ_NotSupportApi | the player's mobile QQ client doesn't support this interface | guide the player to upgrade mobile QQ client |
1006 | eFlag_QQ_AccessTokenExpired | accesstoken expires | return to the login page, and guide the player to get the login authorization again |
1007 | eFlag_QQ_PayTokenExpired | paytoken expires | return to the login page, and guide the player to get the login authorization again |
WeChat related:
return code | name | description | recommended handling method |
---|---|---|---|
2000 | eFlag_WX_NotInstall | the player's device doesn't install WeChat client | guide the player to install WeChat client |
2001 | eFlag_WX_NotSupportApi | the player's WeChat client doesn't support this interface | guide the player to upgrade WeChat client |
2002 | eFlag_WX_UserCancel | the player cancels WeChat-authorized login | return to the login page, and notify that the player has cancelled WeChat-authorized login |
2003 | eFlag_WX_UserDeny | the player refuses WeChat-authorized login | return to the login page, and notify that the player has refused WeChat-authorized login |
2004 | eFlag_WX_LoginFail | WeChat login fails | return to the login page, and guide the player to get the login authorization again |
2005 | eFlag_WX_RefreshTokenSucc | WeChat refreshes the token successfully | get WeChat token, and login the game |
2006 | eFlag_WX_RefreshTokenFail | WeChat refreshes the token unsuccessfully | return to the login page, and guide the player to get the login authorization again |
2007 | eFlag_WX_AccessTokenExpired | WeChat accessToken expires | try to use refreshtoken to refresh the token |
2008 | eFlag_WX_RefreshTokenExpired | WeChat refreshtoken expires | return to the login page, and guide the player to get the login authorization again |
account inconsistency related:
return code | name | description | recommended handling method |
---|---|---|---|
3001 | eFlag_NeedLogin | the game's local account and launched account can not login the game | return to the login page, and guide the player to get the login authorization again |
3002 | eFlag_UrlLogin | Account inconsistency does not exist. The game is quickly logged in successfully via the launched account | read the token in LoginRet struct for the game's authorization process |
3003 | eFlag_NeedSelectAccount | there is account inconsistency between the game's local account and launched account | pop up a dialog box to let the user select the login account |
3004 | eFlag_AccountRefresh | Account inconsistency does not exist. MSDK has refreshed the local account token via the refresh interface | read the token in LoginRet struct for the game's authorization process |
Related to mobile QQ group (v2):
Return code | Description | Recommended handling way |
---|---|---|
221001 | Bound group | No need to deal with |
221002 | Unbound group | No need to deal with |
221003 | Bound group packet return error | No need to deal with |
221004 | Fail in getting uin and tskey | check if the login state is correct |
221005 | Current user is not group leader | No need to deal with |
221006 | Invalid openid | Check if the openid is valid |
221007 | Parameter is invalid | Check the interface parameters, like appid, guild_id,zone_id, gc. For details, refer to interface parameter list |
221008 | No interface call authority | Refer to authority management to apply for authority |
-182001 | Fail in requesting group background cgi | No need to deal with |
-182002 | Fail in operating cmem | No need to deal with |
-182003 | "Create group" fails | No need to deal with |
-182004 | Fail in searching the group | No need to deal with |
-182005 | Fail in converting openid into uin | No need to deal with |
-182008 | Fail in consulting the idip | No need to deal with |
-500003~-500009 | Fail in parsing services and returning the data | No need to deal with |
-120000 | login state verification failed | Check if the login state is effective |
Related to WeChat group (create a group, unbind a group):
Return code | Description | Recommended handling way |
---|---|---|
-1 | System error | Retry once; if failed, please contact the mobile & online game department's MSDK technical support staff through the enterprise's QQ (800013811). |
-10000 | internal error | game fails to create the group authority. |
-10001 | This game has no authority to create group | The game did not open or create the group authority in the game center. |
-10002 | Parameter check error | Confirm the correctness of parameters; if failed, please contact the mobile & online game department's MSDK technical support staff through the enterprise's QQ (800013811). |
-10003 | Link does not exist (has nothing to do with the group) | None |
-10004 | Failed to get hoplink (has nothing to do with the group) | None |
-10005 | group ID has already existed | Never create the group repeatedly |
-10006 | Number of created group exceeds the upper limit | Change a user to create the group |
-10007 | group ID does not exist | Use the existing group ID |
-10008 | group ID is unavailable | group ID may create only one group chat in a day, and the continual creation may be conducted on the next day (if the group ID has been unbound, the group IP may not create the group within 24 hours ) |
-10009 | The user is not in the group | None |
-20001 | Groups created by the user exceed the limit | Number of groups created by users shall not exceed 20 or the number of unbound groups shall not exceed 20 |
-201608 | kv read fails | Contact interface personnel in relation to WeChat |
-201609 | kv write fails | Contact interface personnel in relation to WeChat |
Related to WeChat group (create a group, unbind a group); the error codes are used in 2.18.0 and later versions; their Anroid and iOS versions are unified:
Return code | Description | Recommended handling way |
---|---|---|
-1 | System error | Retry once; if failed, please contact the mobile & online game department's MSDK technical support staff through the enterprise's QQ (800013811). |
2014 | A group has been created today | Use another id to create a group. |
2015 | The number of groups joined with the ID exceeds the upper limit | Try again the next day. |
2009 | No permission to create groups | Contact product staff to open the permission. |
2012 | The number of created or unbound groups exceeds the upper limit | None |
2011 | WeChat group already exists | None |
2013 | Group ID does not exist | None |
2010 | Parameter check error | None |
Others
return code | name | description | recommended handling method |
---|---|---|---|
0 | eFlag_Succ | success | Handled according to the interface's success logic |
-1 | eFlag_Error | error | handled according to the default error handling method of the interface |
2 | eFlag_Local_Invalid | account automatic login failed, due to the local token expiration, refresh failure and other errors | return to the login page, and guide the player to get the login authorization again |
-3 | eFlag_NotInWhiteList | the player's account is not in the white list | prompt the player not to grab numbers yest, and guide the player to enter MyApp to grab numbers |
4 | eFlag_LbsNeedOpenLocationService | LBS required by the game is not opened yet | guide the user to open LBS |
5 | eFlag_LbsLocateFail | game location fails | tips player situation fails |
3005 | eFlag_Need_Realname_Auth | the game requires real-name authentication | suspend the handling of the game on msdk login timeout |
eQQScene
eQQScene
Mobile QQ scene enumeration
public enum eQQScene{
QQScene_None=0,
QQScene_QZone=1, //Qzone
QQScene_Session=2 //mobile QQ session
}
eWechatScene
WeChat scene enumeration
public enum eWechatScene{
WechatScene_Session=0, //WeChat session
WechatScene_Timeline=1 //WeChat Moments
}
ePlatform
Platform enumeration
public enum ePlatform{
ePlatform_None=0, //Not login
ePlatform_Weixin=1, //WeChat platform
ePlatform_QQ=2, //mobile QQ platform
ePlatform_WTLogin=3, //WTLogin login
ePlatform_QQHall=4, //mobile QQ game hall
ePlatform_Guest=5, //guest login
ePlatform_Auto=6 //Automatic login, use the last platform
}
NoticeInfo
Notice information
public class NoticeInfo{
public String msg_id; /* notice id */
public String open_id; /* the user's open_id */
public String msg_url ; /* notice hoplink */
public int msg_type ; /* notice display type, scroll out */
public String msg_scene ; /* notice display scene; the administration end's back-end configuration */
public String start_time; /* notice valid period's start time */
public String end_time ; /* notice valid period's end time */
public String update_time ; /* notice update time */
public int content_type;/* notice content type,eMSG_CONTENTTYPE */
public int msg_order;/*notice priority level */
/*text notice's special field */
public String msg_title ; /* notice title */
public String msg_content;/* notice content */
/*webpage notice's special field */
public String content_url;
public Vector<PicInfo> picArray=new Vector<PicInfo>();
/*User-defined parameters*/
public String mNoticeCustom="";
}
Level of log reported to bugly
eBuglyLogLevel
public enum eBuglyLogLevel{
eBuglyLogLevel_S=0, /* Silent */
eBuglyLogLevel_E=1, /* Error */
eBuglyLogLevel_W=2, /* Warnning */
eBuglyLogLevel_I=3, /* Info */
eBuglyLogLevel_D=4, /* Debug */
eBuglyLogLevel_V=5, /* Verbose */
}
eApiName
public enum eApiName{
eApiName_WGSendToQQWithPhoto=0,
eApiName_WGJoinQQGroup=1,
eApiName_WGAddGameFriendToQQ=2,
eApiName_WGBindQQGroup=3
}
eStatusType
public enum eStatusType{
ISCREATED=0,
ISJONINED=1
}
eRelationRetType
public enum eRelationRetType{
eRet_QueryMyInfo=0,
eRet_QueryGameFriends=1
}
LocalMessageIOS
public class LocalMessageIOS{
public String fireDate { get; set; } /*local push's triggering time, format yyyy-MM-dd HH:mm:ss */
public String alertBody { get; set; } /*the push content */
public int badge { get; set; } /*the number of the superscript */
public String alertAction { get; set; } /*replace the button text content of the popup box (default to "Start") */
public List<KVPair> userInfo { get; set; } /*user-defined parameter, which can be used to identify push and add additional information */
public String userInfoKey { get; set; } /*the identifier Key of the local push in the front-end push */
public String userInfoValue { get; set; } /*the corresponding value of the identifier Key of the local push in the front-end push */
public LocalMessageIOS(){
fireDate="";
alertBody="";
alertAction="";
userInfoKey="";
userInfoValue="";
}
}
LocalMessageAndroid
public class LocalMessageAndroid{
public int type { get; set; } /* message type: 1: notification, 2: message */
public int action_type { get; set; } /* action type, 1 open activity or app itself, 2 open webview, 3 open Intent, 4 open app via the package name; default to 1 */
public String title { get; set; } /* message title: message title */
public String content { get; set; } /* message content: message content */
public String custom_content { get; set; } /* the message's user-defined content */
public int icon_type { get; set; } /* Is the notification bar icon an in-app icon or an uploaded icon (0 means in-app icon, 1 means uploaded icon; default to 0) */
public int lights { get; set; } /* Is it a breathing light? (0 no, 1 yes; default to 1) */
public int ring { get; set; } /* Is it a ring? (0 no, 1 yes; default to 1) */
public int vibrate { get; set; } /* Is it a vibration? (0 no, 1 yes; default to 1) */
public int style_id { get; set; } /* Do Web-end settings cover the notification style numbered build_id? default to 1, 0 no, 1 yes */
public long builderId { get; set; } /* message style, default to 0 or not set */
public String activity { get; set; } /* open the specified Activity, such as: com.qq.xgdemo.AboutActivity. When action type is 1 or 4, the action is valid */
public String packageDownloadUrl { get; set; }
public String packageName { get; set; } /* launch other app's package name. When action type is 4, the action is valid */
public String icon_res { get; set; } /* in-app icon file name (xg.png) or downloaded icon's url, such as: xg or image url */
public String date { get; set; } /* date of popping up notification; the format is ”yyyyMMdd” */
public String hour { get; set; } /* date of popping up notification, in hours */
public String min { get; set; } /* date of popping up notification, in minutes */
public String intent { get; set; } /* set and open intent, such as (10086 dial page )intent:10086#Intent;scheme=tel;action=android.intent.action.DIAL;S.key=value;end;when action type is 3, the action is valid */
public String url { get; set; } /* open url, such as:http://www.qq.com。When action type is 2, the action is valid */
public String ring_raw { get; set; } /* specify in-app sound (ring.mp3), such as: ring */
public String small_icon { get; set; } /* specify the status bar's small picture (xg.png), such as: xg */
public LocalMessageAndroid(){
type=1;
action_type=-1;
icon_type=-1;
lights=-1;
ring=-1;
vibrate=-1;
style_id=-1;
builderId=-1;
content="";
custom_content="";
activity="";
packageDownloadUrl="";
packageName="";
icon_res="";
date="";
hour="";
intent="";
min="";
title="";
url="";
ring_raw="";
small_icon="";
}
}
GetCountryFromIPRet
typedef struct
{
int ret; // query result flag; 0 means success
std::string msg; // description
std::string country; // country
bool isQueryByRequestHeader; // indicate whether to query the request header
} GetCountryFromIPRet;
GetIPInfoRet
typedef struct
{
int ret; //Query result flag, 0 means success
int country_no; //Country number
int province_no; //Province number
int city_no; //City number
std::string msg; //Description
std::string country; //Country
std::string province; //Province
std::string city; //City
bool isQueryByRequestHeader; //A flag used to show whether to query the request header
} GetIPInfoRet;