更新日期:2017-12-01QuickSDK-Java(Android)
There are some requirements that QuickSDK suggest to game project
the following problems after game accessed QuickSDK,
· Android:targetSdkVersion of AndroidManifest.xml ="19"
Fix the problem that market sdk is incompatible to android 5.0
· If there is installLocation in AndroidManifest.xml, parameter set as auto
To solve the problem that APK can not be installed
· The Activity in AndroidManifest.xml shall configured as followed
android:configChanges="keyboardHidden|orientation|screenSize"
In case of the landscape-portrait swichover problem that may happened between game and market sdk.
·U3D game project ,AndroidManifest.xml
Android: value set as true
· Add Landscape-portrait screen setting for Activity
Activity Landscape-portrait screen according to game screen orientation
android:screenOrientation="sensorLandscape" android:screenOrientation="sensorPortrait"
or
android:screenOrientation="landscape" android:screenOrientation="portrait"
· Component path in AndroidManifest.xml such as Activity is full path
All contents under “com.quicksdk” class path will be deleted when packing market package if you used the class path “com.quicksdk” when create game project.
Loading QuickSDK resource(http://www.quicksdk.com/download.html), and copy assets,libs and res to project corresponding files.
Adding authority in Androidmanifest.xml
The creating game Application inherit from QuickSdkApplication
public class GameApplication extends QuickSdkApplication { @Override public void onCreate() { super.onCreate(); } }
Application nude in AndroidManifest.xml, modifying android:name nature, whose value is full path of game new creating Application.
......
Create game splash screen Activity,which is inherit from QuickSdkSplashActivity
public class SplashActivity extends QuickSdkSplashActivity { @Override public int getBackgroundColor() { return Color.WHITE; } @Override public void onSplashStop() { //turn to game interface after splash screen stopped Intent intent = new Intent(this, MainActivity.class); startActivity(intent); this.finish(); } }
android:name="*.*.*.SplashActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="landscape" >
Instruction:
android:name nature,whose value is full path of game-defined splash screen activity.
android:screenOrientation nature, whose value decided the screen orientation according to game needs.
Game Activity life cycle processing, call corresponding method.
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); com.quicksdk.Sdk.getInstance().onCreate(this); } @Override protected void onStart() { super.onStart(); com.quicksdk.Sdk.getInstance().onStart(this); } @Override protected void onRestart() { super.onRestart(); com.quicksdk.Sdk.getInstance().onRestart(this); } @Override protected void onPause() { super.onPause(); com.quicksdk.Sdk.getInstance().onPause(this); } @Override protected void onResume() { super.onResume(); com.quicksdk.Sdk.getInstance().onResume(this); } @Override protected void onStop() { super.onStop(); com.quicksdk.Sdk.getInstance().onStop(this); } @Override protected void onDestroy() { super.onDestroy(); com.quicksdk.Sdk.getInstance().onDestroy(this); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); com.quicksdk.Sdk.getInstance().onNewIntent(intent); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); com.quicksdk.Sdk.getInstance().onActivityResult(this, requestCode, resultCode, data); }
Class:QuickSDK
Method:public QuickSDK setInitNotifier(InitNotifier notifier)
Function:Setting initialized result callback notification before game started, Started game log in etc and relevant processes once initialized successfully.
Example:
QuickSDK.getInstance().setInitNotifier(new InitNotifier() { @Override public void onSuccess() { //initialized succeed } @Override public void onFailed(String message, String trace) { //initialized failed } });
Class:QuickSDK
Method:public QuickSDK setLoginNotifier(LoginNotifier notifier)
Function: Setting relevant processing of user log in result callback notification.
Example:
QuickSDK.getInstance().setLoginNotifier(new LoginNotifier() { @Override public void onSuccess(UserInfo userInfo) { // log in succeed, get user information userInfo // certificate server log in through UID, token of userInfo } @Override public void onCancel() { //log in cancel } @Override public void onFailed(final String message, String trace) { //log in failed } });
Log in information:
UserInfo
Field | type | Instruction |
UID | String | User ID, the only ID that SDK returned to |
username | String | User name |
token | String | Verifying user token |
Access requirements:
1)Initiate game, received log in succeed notification in login interface, then skip to game interface;
2)When game client call auto login receiving login fail/cancel notification, shall call login function again.
3)Different markets may return same UID, the only method that game client use to identify user is ID+UID. To obtain market ID by “public int getChannelType()”
Class:QuickSDK
Method:public QuickSDK setLogoutNotifier(LogoutNotifier notifier)
Function: Set process such as user log out result , callback notification
Example:
QuickSDK.getInstance().setLogoutNotifier(new LogoutNotifier() { @Override public void onSuccess() { //log out succeed } @Override public void onFailed(String message, String trace) { // log out fail, no processing } });
Access requirement: Receiving log out succeed notification , game shall return to login interface.
Class:QuickSDK
Method:public QuickSDK setSwitchAccountNotifier(SwitchAccountNotifier notifier)
Function:Set the processing of user switch account result callback notification.
Example:
QuickSDK.getInstance().setSwitchAccountNotifier(new SwitchAccountNotifier() { @Override public void onSuccess(UserInfo userInfo) { // userInfo Switch account succeed, return to new account userInfo } @Override public void onCancel() { //Switch account cancel } @Override public void onFailed(String message, String trace) { //Switch account fail } })
Switch account succeed information:
UserInfo
Field | Type | Instruction |
UID | String | User ID,the only ID that SDK returned |
username | String | User login name |
token | String | User verify token |
Access requirement:
In game interface ,receiving switch account succeed notification, game client log out current role, using new user information, back to access game interface.
Class:QuickSDK
Method:public QuickSDK setPayNotifier(PayNotifier notifier)
Function: Set relevant process of user payment result callback notification
Example:
QuickSDK.getInstance().setPayNotifier(new PayNotifier() { @Override public void onSuccess(String sdkOrderID, String cpOrderID, String extrasParams) { //Paid succeed //sdkOrderID:quick Order number cpOrderID:Game client order number } @Override public void onCancel(String cpOrderID) { //payment cancel } @Override public void onFailed(String cpOrderID, String message, String trace) { //payment fail } });
Instruction: Whether the game recharge succeed according to the only official notification from server.(Since some market SDK may not send the correct notification , the client notification is not that reliable)
Class:QuickSDK
Method:public QuickSDK setExitNotifier(ExitNotifier notifier)
Function: Set relevant process of user exit result callback notification.
Example:
QuickSDK.getInstance().setExitNotifier(new ExitNotifier() { @Override public void onSuccess() { // exit succeed, exit process itself } @Override public void onFailed(String message, String trace) { // Exit fail, no processing } });
Access requirement: Game exit processing itself after receiving exit succeed notification.
Access requirement: Call SDK API under UI main thread.
Class:com.quicksdk.Sdk
Method:public void init(Activity activity, String productCode, String productKey)
Function:Market SDK initialization
Parameter:activity always the current Activity
productCode always the productCode which is applied in QuickSDK background
productKey always productKey which is applied in QuickSDK background
Example:
com.quicksdk.Sdk.getInstance().init(activity, " productCode applied in background", " productKey applied in background ");
Access requirement: Initializing API shall be called onCreate method of Activity
Class:com.quicksdk.User
Method:public void login(Activity activity)
Function: Call market SDK login
Parameter:activity always current Activity
Example:
User.getInstance().login(activity);
Access requirement: Entering login interface, autocall this API, and call login API after initialized succeed.
Name:com.quicksdk.User
Method:public void setGameRoleInfo(Activity activity, GameRoleInfo roleInfo, boolean createRole)
Function: Uploading role information to Market SDK
Parameter:activity always current Activity
roleInfo always role information
createRole always if create role
Example:
// GameRoleInfo field, it must be transferred once there are parameters of game in GameRoleInfo field,and it’s unnecessary to transfer the parameters which are not in GameRoleInfo field. GameRoleInfo roleInfo = new GameRoleInfo(); roleInfo.setServerID("1");// number string , which can not including Chinese character. roleInfo.setServerName("server 1"); roleInfo.setGameRoleName("stone"); roleInfo.setGameRoleID("1121121"); roleInfo.setGameBalance("5000"); roleInfo.setVipLevel("4"); // Setting the current users VIP level which must be integer string. roleInfo.setGameUserLevel("12"); // Setting game user level roleInfo.setPartyName("Unstoppable"); // Setting party name roleInfo.setRoleCreateTime("1473141432"); // There are 3 market must transfer, they are UC.com,dangle.com and 1881.com respectively, and the value is 10 digit timestamp. roleInfo.setPartyId("1100"); // 360.com parameters, set party ID which must be integer string. roleInfo.setGameRoleGender("male"); //market 360/360.com parameter roleInfo.setGameRolePower("38"); // 360.com parameter, set role power,which must be integer string. roleInfo.setPartyRoleId("11"); // 360.com parameter ,set party role id. roleInfo.setPartyRoleName("party leader"); // 360.com parameter set party role name. roleInfo.setProfessionId("38"); // 360.com parameter,set role profession id which must be integer string. roleInfo.setProfession("master"); // 360.com parameter , set role profession name. roleInfo.setFriendlist("no"); //360.com parameter, set friend list,format refer to:http://open.quicksdk.net/help/detail/aid/190
Creating Role
User.getInstance().setGameRoleInfo(activity, roleInfo, true);
Entering game and updating role
User.getInstance().setGameRoleInfo(activity, roleInfo, false);
GameRoleInfo
string | type | Instructino |
serverID | String | server ID(number string) |
serverName | String | server name |
gameRoleName | String | Game Role name |
gameRoleID | String | Game Role ID |
gameRoleBalance | String | Game role balance |
vipLevel | String | VIP level |
gameRoleLevel | String | game role level |
partyName | String | Party |
roleCreateTime | String | role create time (10 digit timestamp) |
partyId | String | Party id |
gameRoleGender | String | Game role gender |
gameRolePower | String | Role power |
partyRoleId | String | Party role ID |
partyRoleName | String | Party role name |
professionId | String | Role profession ID |
profession | String | Role profession name |
friendlist | String | Friend list |
Access instruction:
1) Call this API when creating role, entering game and updating role. createRole value is true while creating game role, for the rest situations—entering game or updating role, the value is false.
2) All strings in GameRoleInfo can not transfer null , if there is no such string, transfer default value or null string.
3) In roleCreateTime field, only UC.com and 1881.com must transfer this parameter, whose value is 10 digit timestamp.
4) It is necessarily for 360.com to transfer these 8 fields --partyId,gameRoleGender,gameRolePower,partyRoleId,partyRoleName,professionId,profession,friendlist,only transfer the fields which included in game, other markets do not need to transfer them.
5) Specific instruction of uploading role information to 360.com, refer to :http://open.quicksdk.net/help/detail/aid/190
Class :com.quicksdk.Payment
Method :public void pay(final Activity activity, final OrderInfo orderInfo, final GameRoleInfo roleInfo)
Function: call market SDK pay
Parameter:activity always current Activity
orderInfo always order information
roleInfo always role information
Example:
GameRoleInfo roleInfo = new GameRoleInfo(); roleInfo.setServerID("1");//number string roleInfo.setServerName("server1"); roleInfo.setGameRoleName("stone"); roleInfo.setGameRoleID("1121121"); roleInfo.setGameUserLevel("12"); roleInfo.setVipLevel("Vip4"); roleInfo.setGameBalance("5000"); roleInfo.setPartyName("xxparty"); OrderInfo orderInfo = new OrderInfo(); orderInfo.setCpOrderID("20150917003200119310"); orderInfo.setGoodsName("yuanbao");// goods name without quantity orderInfo.setCount(60);// game currency quantity orderInfo.setAmount(6); orderInfo.setGoodsID("1"); orderInfo.setExtrasParams("extra parameter"); Payment.getInstance().pay(activity, orderInfo, roleInfo);
payment information parameter form:
OrderInfo
field | type | instruction |
goodsID | String | Goods ID, identifying the purchased goods. |
goodsName | String | goods name |
cpOrderID | String | Goods order number( game client order number) |
count | int | game currency quantity |
amount | double | Total amount(¥) |
extrasParams | String | Extras parameter |
In order to unify all market goods name, orders should be transferred in by following patterns:
Example 1: Example2:
amount:6.0 amount:10.0
count:60 count:1
goodsName: yuanbao goodsName: month card
Access requirement:
· GoodsName transferred in “month card”,”diamond”,”yuanbao”pattern without quantity;
· Field Count in OrderInfo stands for game currency quantity.
·All fields in OrderInfo, GameRoleInfo can not transfer null, if there’s no such field in game transferring a default value or null string/empty string.
Class:com.quicksdk.User
Method:public void logout(Activity activity)
Function: market SDK log out.
Example:
User.getInstance().logout(activity);
Class:com.quicksdk.Sdk
Method:public void exit(Activity activity)
Function: Market SDK exit, when game server is in exiting logic, we can judge if there is exitdialog by isShowExitDialog API. Call QuickSDK exit API directly if there is exit dialog; call exit dialog by game itself, click “yes”,then call QuickSDK exit API if there’s no exit dialog in market.
Example:
// Judging if there is exit dialog in market SDK by isShowExitDialog if(QuickSDK.getInstance().isShowExitDialog()){ Sdk.getInstance().exit(activity); }else{ // call exit dialog of game, click “yes”,then call quick exit API new AlertDialog.Builder(MainActivity.this).setTitle("退出").setMessage("if exit game?").setPositiveButton("yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { Sdk.getInstance().exit(MainActivity.this); } }).setNegativeButton("cancel", null).show(); }
Class :com.quicksdk.Extend
Method:public int getChannelType()
Function:obtain market number
Instruction:Market ID
Example:Extend.getInstance().getChannelType();
Class :com.quicksdk.Extend
Method :public String getExtrasConfig(String key)
Function:obtain configuration parameter value
Instruction:Operating game defined parameter configuration in quicksdk.xml files, change it when packaging according to the rules.
Example:Extend.getInstance().getExtrasConfig("key");
Class :com.quicksdk.Extend
Method :public boolean isFunctionSupported(final int funcType)
Function: whether it supports designated method.
Instruction: There are functions in some SDK such as open/close floating tool bar, enter user center, enter forum; it can be used for judging whether it support the designated method during gaming;definition of designated method refer to SDK lib com.quicksdk.FuncType.
Example :Extend.getInstance().isFunctionSupported(FuncType.HIDE_TOOLBAR); // if it support hiding floating dialog function
Class :com.quicksdk.Extend
Method :public String callFunction(final Activity activity, final int funcType)
Function: call designated method
Instruction: There are functions such as display/hide floating button, enter user center, enter forum, it can call third party market supporting method before using isFunctionSupported to judge.
Example:Extend.getInstance().callFunction(activity, FuncType.HIDE_TOOLBAR); // call hide floating dialog method
QuickSDK has been through mixed, if java code is mixed, do not mix the bider classes in jar package. And it can add following class to proguard configuration, excluding the mix:
-keep class com.quicksdk.** { *; }
Once there are some needs for game client to set relevant market parameter, it can add self-defined parameter through quick background, configure corresponding value in market list, then obtain the value through Extend.getInstance().getExtrasConfig(String key).
All API access succeed, there is the origin package, which is the test example for testing, and when it passed test, there is the correct market package.
李先生:13880511661
QQ:48157910
赵先生:15390049857
QQ:1077535763
孙女士:13551010407
QQ:1799614139
QQ群:698731538