Commit b53b3a3068f3eb43568cf367a75a482220fb148a

Authored by 赵康
1 parent bd0fbf81f0
Exists in master

update 3.3.4,解除vk依赖关系,修改支付不准确回调问题

Showing 6 changed files with 11 additions and 11 deletions Inline Diff

android/GameSDKRelease/libs/GameSDK_v3.3.3_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/GameSDK_v3.3.4_proguard.jar
No preview for this file type
android/GameSDKRelease/project.properties
1 # This file is automatically generated by Android Tools. 1 # This file is automatically generated by Android Tools.
2 # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 2 # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 # 3 #
4 # This file must be checked in Version Control Systems. 4 # This file must be checked in Version Control Systems.
5 # 5 #
6 # To customize properties used by the Ant build system edit 6 # To customize properties used by the Ant build system edit
7 # "ant.properties", and override values to adapt the script to your 7 # "ant.properties", and override values to adapt the script to your
8 # project structure. 8 # project structure.
9 # 9 #
10 # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 10 # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 11 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 12
13 # Project target. 13 # Project target.
14 target=android-19 14 target=android-21
15 android.library=true 15 android.library=true
16 android.library.reference.1=..\\..\\..\\..\\..\\facebook 16 android.library.reference.1=..\\..\\..\\..\\..\\facebook
17 android.library.reference.2=../../../../../Project/vksdk_library 17 android.library.reference.2=../../../../../Project/vksdk_library
18 18
android/GameSDKSample/project.properties
1 # This file is automatically generated by Android Tools. 1 # This file is automatically generated by Android Tools.
2 # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 2 # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 # 3 #
4 # This file must be checked in Version Control Systems. 4 # This file must be checked in Version Control Systems.
5 # 5 #
6 # To customize properties used by the Ant build system edit 6 # To customize properties used by the Ant build system edit
7 # "ant.properties", and override values to adapt the script to your 7 # "ant.properties", and override values to adapt the script to your
8 # project structure. 8 # project structure.
9 # 9 #
10 # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 10 # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 11 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 12
13 # Project target. 13 # Project target.
14 14
15 target=android-21 15 target=android-22
16 android.library.reference.1=../GameSDKRelease 16 android.library.reference.1=../GameSDKRelease
17 17
android/GameSDKSample/src/com/gumptech/loginsdk/sample/MainActivity.java
1 package com.gumptech.loginsdk.sample; 1 package com.gumptech.loginsdk.sample;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Context; 4 import android.content.Context;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.text.ClipboardManager; 6 import android.text.ClipboardManager;
7 import android.util.Log; 7 import android.util.Log;
8 import android.view.View; 8 import android.view.View;
9 import android.widget.Button; 9 import android.widget.Button;
10 import android.widget.TextView; 10 import android.widget.TextView;
11 import android.widget.Toast; 11 import android.widget.Toast;
12 12
13 import com.gumptech.sdk.GumpPreference; 13 import com.gumptech.sdk.GumpPreference;
14 import com.gumptech.sdk.GumpSDK; 14 import com.gumptech.sdk.GumpSDK;
15 import com.gumptech.sdk.bean.GumpUser; 15 import com.gumptech.sdk.bean.GumpUser;
16 import com.gumptech.sdk.bean.PurchaseResult; 16 import com.gumptech.sdk.bean.PurchaseResult;
17 import com.gumptech.sdk.callback.InitializeCallback; 17 import com.gumptech.sdk.callback.InitializeCallback;
18 import com.gumptech.sdk.callback.LoginStateListener; 18 import com.gumptech.sdk.callback.LoginStateListener;
19 import com.gumptech.sdk.callback.PurchaseCallback; 19 import com.gumptech.sdk.callback.PurchaseCallback;
20 import com.gumpsdk.wuruid.R; 20 import com.gumpsdk.wuruid.R;
21 21
22 public class MainActivity extends Activity implements PurchaseCallback{ 22 public class MainActivity extends Activity implements PurchaseCallback{
23 23
24 private static final String TAG = "MainActivity"; 24 private static final String TAG = "MainActivity";
25 25
26 private TextView tvVersion; 26 private TextView tvVersion;
27 private TextView userInfo; 27 private TextView userInfo;
28 28
29 private Button btnLoginOrLogout; 29 private Button btnLoginOrLogout;
30 30
31 private String appId = "10022"; 31 private String appId = "10022";
32 private String appKey = "93a27b0bd99bac3e68a440b48aa421ab"; 32 private String appKey = "93a27b0bd99bac3e68a440b48aa421ab";
33 33
34 @Override 34 @Override
35 protected void onCreate(Bundle savedInstanceState) { 35 protected void onCreate(Bundle savedInstanceState) {
36 super.onCreate(savedInstanceState); 36 super.onCreate(savedInstanceState);
37 setContentView(R.layout.activity_main); 37 setContentView(R.layout.activity_main);
38 tvVersion = (TextView) findViewById(R.id.version); 38 tvVersion = (TextView) findViewById(R.id.version);
39 userInfo = (TextView) findViewById(R.id.user_info); 39 userInfo = (TextView) findViewById(R.id.user_info);
40 btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); 40 btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout);
41 btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { 41 btnLoginOrLogout.setOnClickListener(new View.OnClickListener() {
42 42
43 @Override 43 @Override
44 public void onClick(View v) { 44 public void onClick(View v) {
45 if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) 45 if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0)
46 GumpSDK.start(MainActivity.this); 46 GumpSDK.start(MainActivity.this);
47 else 47 else
48 GumpSDK.logout(MainActivity.this); 48 GumpSDK.logout(MainActivity.this);
49 } 49 }
50 }); 50 });
51 findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { 51 findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() {
52 52
53 @Override 53 @Override
54 public void onClick(View v) { 54 public void onClick(View v) {
55 Bundle payInfo = new Bundle(); 55 Bundle payInfo = new Bundle();
56 payInfo.putString("nick", "thi"); 56 payInfo.putString("nick", "thi");
57 payInfo.putString("product", "元宝"); 57 payInfo.putString("product", "元宝");
58 payInfo.putFloat("amount", 0.0f); 58 payInfo.putFloat("amount", 0.0f);
59 payInfo.putString("extraInfo", "This is demo!"); 59 payInfo.putString("extraInfo", "This is demo!");
60 payInfo.putString("serverId", "5001"); 60 payInfo.putString("serverId", "5025");
61 GumpSDK.pay(MainActivity.this, payInfo, "3332768", MainActivity.this); 61 GumpSDK.pay(MainActivity.this, payInfo, "7798753", MainActivity.this);
62 } 62 }
63 }); 63 });
64 /** 64 /**
65 * 设置否是开启debug模式 65 * 设置否是开启debug模式
66 */ 66 */
67 GumpSDK.setDebugState(true); 67 GumpSDK.setDebugState(true);
68 /** 68 /**
69 * 设置是否启用facebook登录 69 * 设置是否启用facebook登录
70 */ 70 */
71 GumpSDK.setFBEnable(true); 71 GumpSDK.setFBEnable(true);
72 /** 72 /**
73 * 设置是否启用Vk登录 73 * 设置是否启用Vk登录
74 */ 74 */
75 GumpSDK.setVKEnable(false); 75 GumpSDK.setVKEnable(true);
76 /** 76 /**
77 * 设置屏幕方向 77 * 设置屏幕方向
78 */ 78 */
79 GumpSDK.setScreenLandscape(false); 79 GumpSDK.setScreenLandscape(false);
80 /** 80 /**
81 * 设置用户登录状态监听器 81 * 设置用户登录状态监听器
82 */ 82 */
83 GumpSDK.setUserStateListener(new LoginStateListener() { 83 GumpSDK.setUserStateListener(new LoginStateListener() {
84 @Override 84 @Override
85 public void onLoginSuccess(GumpUser user) { 85 public void onLoginSuccess(GumpUser user) {
86 ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); 86 ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
87 cm.setText(user.getSessionKey()); 87 cm.setText(user.getSessionKey());
88 88
89 String userType=null; 89 String userType=null;
90 switch(user.getAccountType()){ 90 switch(user.getAccountType()){
91 case GumpPreference.ACCOUNT_TYPE_FB: 91 case GumpPreference.ACCOUNT_TYPE_FB:
92 userType = "Facebook登录"; 92 userType = "Facebook登录";
93 break; 93 break;
94 case GumpPreference.ACCOUNT_TYPE_QUICK_REG: 94 case GumpPreference.ACCOUNT_TYPE_QUICK_REG:
95 userType = "快速登录"; 95 userType = "快速登录";
96 break; 96 break;
97 case GumpPreference.ACCOUNT_TYPE_REG: 97 case GumpPreference.ACCOUNT_TYPE_REG:
98 userType = "gump注册用户"; 98 userType = "gump注册用户";
99 break; 99 break;
100 case GumpPreference.ACCOUNT_TYPE_VK: 100 case GumpPreference.ACCOUNT_TYPE_VK:
101 userType = "vk登录"; 101 userType = "vk登录";
102 break; 102 break;
103 } 103 }
104 userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType()+") "+userType + "\n sessionKey:" + user.getSessionKey()); 104 userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType()+") "+userType + "\n sessionKey:" + user.getSessionKey());
105 btnLoginOrLogout.setText("Logout"); 105 btnLoginOrLogout.setText("Logout");
106 btnLoginOrLogout.setTag(1); 106 btnLoginOrLogout.setTag(1);
107 } 107 }
108 108
109 @Override 109 @Override
110 public void onLoginFailed(int code, String msg) { 110 public void onLoginFailed(int code, String msg) {
111 userInfo.setText(msg); 111 userInfo.setText(msg);
112 Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); 112 Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show();
113 } 113 }
114 114
115 @Override 115 @Override
116 public void onLoginCanceled() { 116 public void onLoginCanceled() {
117 Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); 117 Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show();
118 } 118 }
119 119
120 @Override 120 @Override
121 public void onLogout() { 121 public void onLogout() {
122 btnLoginOrLogout.setText("Login"); 122 btnLoginOrLogout.setText("Login");
123 btnLoginOrLogout.setTag(0); 123 btnLoginOrLogout.setTag(0);
124 userInfo.setText("User is logout"); 124 userInfo.setText("User is logout");
125 } 125 }
126 }); 126 });
127 /** 127 /**
128 * 初始化sdk 128 * 初始化sdk
129 */ 129 */
130 GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { 130 GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() {
131 @Override 131 @Override
132 public void initComplete(int result) { 132 public void initComplete(int result) {
133 if (result == GumpSDK.CODE.OK) { 133 if (result == GumpSDK.CODE.OK) {
134 btnLoginOrLogout.setEnabled(true); 134 btnLoginOrLogout.setEnabled(true);
135 } 135 }
136 } 136 }
137 }); 137 });
138 138
139 139
140 tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); 140 tvVersion.setText("SDK Version:" + GumpSDK.getVersion());
141 } 141 }
142 142
143 @Override 143 @Override
144 public void onPurchaseCompleted(PurchaseResult result) { 144 public void onPurchaseCompleted(PurchaseResult result) {
145 Log.i(TAG,"purchase completed"); 145 Log.i(TAG,"purchase completed");
146 } 146 }
147 147
148 @Override 148 @Override
149 public void onPurchaseError(int code, String msg) { 149 public void onPurchaseError(int code, String msg) {
150 Log.i(TAG,"purchase error"); 150 Log.i(TAG,"purchase error");
151 } 151 }
152 152
153 @Override 153 @Override
154 public void onPurchaseCanceled() { 154 public void onPurchaseCanceled() {
155 Log.i(TAG,"purchase canceled"); 155 Log.i(TAG,"purchase canceled");
156 } 156 }
157 } 157 }
158 158
doc/AndroidDocument.md
1 # Gump Android SDK使用文档 1 # Gump Android SDK使用文档
2 2
3 3
4 接入手册 4 接入手册
5 V 3.3.3 5 V 3.3.4
6 2015年12月23日 6 2016年01月22日
7 7
8 快速入口: 8 快速入口:
9 [支付部分服务端回调文档](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/ServerDocument.md) 9 [支付部分服务端回调文档](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/ServerDocument.md)
10 10
11 ## 目录 11 ## 目录
12 12
13 * [第一章 接入指南](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#) 13 * [第一章 接入指南](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#)
14 - [1. 导入资源工程](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#1) 14 - [1. 导入资源工程](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#1)
15 - [2. 添加资源工程](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#2) 15 - [2. 添加资源工程](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#2)
16 - [3. 代码实现](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#3) 16 - [3. 代码实现](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#3)
17 > [1.修改AndroidManifest.xml文件](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#1-androidmanifest-xml) 17 > [1.修改AndroidManifest.xml文件](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#1-androidmanifest-xml)
18 > [2.向Gump平台索要游戏ID(GID),完成代码接入](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#2-gump-id-gid) 18 > [2.向Gump平台索要游戏ID(AppID),完成代码接入](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#2-gump-id-gid)
19 * [第二章 常见问题](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#) 19 * [第二章 常见问题](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#)
20 - [问题1: 如何避免混淆对SDK的影响?](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#1-sdk) 20 - [问题1: 如何避免混淆对SDK的影响?](http://git.letsgame.mobi/document/gumptech-document/blob/master/AndroidDocument.md#1-sdk)
21 - [问题2:后台已经配置ok的情况下,支付列表仍然为空或登录总是出错?](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/AndroidDocument.md#2-ok) 21 - [问题2:后台已经配置ok的情况下,支付列表仍然为空或登录总是出错?](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/AndroidDocument.md#2-ok)
22 22
23 23
24 24
25 25
26 ## 第一章 接入指南 26 ## 第一章 接入指南
27 配置环境 27 配置环境
28 28
29 本接口API 适用于Android2.2以上各版本Android平台。 29 本接口API 适用于Android2.2以上各版本Android平台。
30 ### 1. 导入资源工程 30 ### 1. 导入资源工程
31 1.将GameSDK资源工程拷贝到工作空间,在eclipse中的导航栏右键弹出如图1画面,选择Import导入资源工程,如图1. 31 1.将GameSDK资源工程拷贝到工作空间,在eclipse中的导航栏右键弹出如图1画面,选择Import导入资源工程,如图1.
32 注意:本sdk需要使用Facebook sdk for android 4.4.1实现fb登录,请自行导入Facebook SDK 32 注意:本sdk需要使用Facebook sdk for android 4.4.1实现fb登录,请自行导入Facebook SDK
33 注意:本sdk需要使用VK sdk for android实现vk登录,请自行导入此sdk 33 注意:本sdk需要使用VK sdk for android 1.5.4实现vk登录,请自行导入此sdk;若不接入vk登录,可以不导入此sdk并忽略vk相关的配置
34 34
35 ![](images/1.png) 35 ![](images/1.png)
36 图1 36 图1
37 37
38 2.导入工程后,右键此工程,在Properties->Android中选中此工程为library工程(勾选红色方框标识处)如图2。 38 2.导入工程后,右键此工程,在Properties->Android中选中此工程为library工程(勾选红色方框标识处)如图2。
39 ![](images/2.png) 39 ![](images/2.png)
40 图 2 40 图 2
41 ### 2. 添加资源工程 41 ### 2. 添加资源工程
42 添加资源工程为游戏项目的 library。右键游戏项目,在Properties->Android中点击Add添加资源工程为项目工程的library,结果如图3。 42 添加资源工程为游戏项目的 library。右键游戏项目,在Properties->Android中点击Add添加资源工程为项目工程的library,结果如图3。
43 ![](images/3.png) 43 ![](images/3.png)
44 图 3 44 图 3
45 45
46 46
47 注意:如果ADT版本低于14,ADT不支持jar包自动引入,请手动拷贝libs到您的工作 47 注意:如果ADT版本低于14,ADT不支持jar包自动引入,请手动拷贝libs到您的工作
48 空间。 48 空间。
49 49
50 Eclipse查看ADT版本号的方法: 50 Eclipse查看ADT版本号的方法:
51 Help==>About Eclips点击Android对应的图标就可以查看版本了. 51 Help==>About Eclips点击Android对应的图标就可以查看版本了.
52 如图,红色框部分就是ADT版本号。 52 如图,红色框部分就是ADT版本号。
53 53
54 ![](images/4.png) 54 ![](images/4.png)
55 55
56 56
57 ### 3. 代码实现 57 ### 3. 代码实现
58 #### 1、 修改AndroidManifest.xml文件 58 #### 1、 修改AndroidManifest.xml文件
59 首先添加必要的权限,如下所示: 59 首先添加必要的权限,如下所示:
60 60
61 <uses-permission android:name="android.permission.INTERNET" /> 61 <uses-permission android:name="android.permission.INTERNET" />
62 <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 62 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
63 <uses-permission android:name="android.permission.BLUETOOTH" /> 63 <uses-permission android:name="android.permission.BLUETOOTH" />
64 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 64 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
65 <uses-permission android:name="android.permission.WRITE_SETTINGS"/> 65 <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
66 <uses-permission android:name="android.permission.GET_ACCOUNTS"/> 66 <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
67 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 67 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
68 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 68 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
69 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> 69 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
70 <uses-permission android:name="android.permission.SEND_SMS"/> 70 <uses-permission android:name="android.permission.SEND_SMS"/>
71 71
72 <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> 72 <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. -->
73 <uses-permission android:name="com.android.vending.BILLING" /> 73 <uses-permission android:name="com.android.vending.BILLING" />
74 74
75 其次注册相应的Activity,具体如下: 75 其次注册相应的Activity,具体如下:
76 76
77 <activity 77 <activity
78 android:name="com.gumptech.sdk.ContainerActivity" 78 android:name="com.gumptech.sdk.ContainerActivity"
79 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" 79 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout"
80 android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 80 android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
81 android:theme="@style/Theme.TransparentWin" > 81 android:theme="@style/Theme.TransparentWin" >
82 </activity> 82 </activity>
83 <activity 83 <activity
84 android:name="com.gumptech.sdk.PaymentActivity" 84 android:name="com.gumptech.sdk.PaymentActivity"
85 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" 85 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout"
86 android:theme="@android:style/Theme.Translucent.NoTitleBar" > 86 android:theme="@android:style/Theme.Translucent.NoTitleBar" >
87 </activity> 87 </activity>
88 <activity 88 <activity
89 android:name="com.gumptech.sdk.ExchangeWindow" 89 android:name="com.gumptech.sdk.ExchangeWindow"
90 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" 90 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout"
91 android:theme="@style/Theme.WinForExchange" > 91 android:theme="@style/Theme.WinForExchange" >
92 </activity> 92 </activity>
93 93
94 <service android:name="com.gumptech.sdk.PushService" > 94 <service android:name="com.gumptech.sdk.PushService" >
95 </service> 95 </service>
96 <!-- facebook --> 96 <!-- facebook -->
97 <activity 97 <activity
98 android:name="com.facebook.FacebookActivity" 98 android:name="com.facebook.FacebookActivity"
99 android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" 99 android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
100 android:label="@string/app_name" 100 android:label="@string/app_name"
101 android:theme="@android:style/Theme.Translucent.NoTitleBar" /> 101 android:theme="@android:style/Theme.Translucent.NoTitleBar" />
102 <!-- vk --> 102 <!-- vk登录使用,若不接入vk,不需配置 -->
103 <activity android:name="com.vk.sdk.VKOpenAuthActivity" /> 103 <activity android:name="com.vk.sdk.VKOpenAuthActivity" />
104 <activity 104 <activity
105 android:name="com.vk.sdk.VKServiceActivity" 105 android:name="com.vk.sdk.VKServiceActivity"
106 android:label="ServiceActivity" 106 android:label="ServiceActivity"
107 android:theme="@style/VK.Transparent" /> 107 android:theme="@style/VK.Transparent" />
108 108
109 109
110 #### 2、 向Gump平台索要游戏ID(GID),完成代码接入 110 #### 2、 向Gump平台索要游戏ID(AppID),完成代码接入
111 正式开始接入逻辑代码前,先介绍下一些附加配置,以方便代码接入 111 正式开始接入逻辑代码前,先介绍下一些附加配置,以方便代码接入
112 112
113 *横竖屏控制,默认为横屏,参数为false即为竖屏 113 *横竖屏控制,默认为横屏,参数为false即为竖屏
114 114
115 GumpSDK.setScreenLandscape(true); 115 GumpSDK.setScreenLandscape(true);
116 *debug模式设置 116 *debug模式设置
117 117
118 GumpSDK.setDebugState(true); 118 GumpSDK.setDebugState(true);
119 119
120 *设置是否启用Facebook登录和VK登录 120 *设置是否启用Facebook登录和VK登录
121 121
122 GumpSDK.setFBEnable(true); 122 GumpSDK.setFBEnable(true);
123 GumpSDK.setVKEnable(true); 123 GumpSDK.setVKEnable(true);
124 1.调用GumpSDK前需要执行初始化。 124 1.调用GumpSDK前需要执行初始化。
125 125
126 若不需要分渠道 126 若不需要分渠道
127 127
128 GumpSDK.init(Context,Appid, Appkey,InitializeCallback); 128 GumpSDK.init(Context,Appid, Appkey,InitializeCallback);
129 如果需要定义渠道,必须使用如下方法 129 如果需要定义渠道,必须使用如下方法
130 130
131 GumpSDK.init(Context,Appid, Appkey,ChannelId,InitializeCallback); 131 GumpSDK.init(Context,Appid, Appkey,ChannelId,InitializeCallback);
132 132
133 InitializeCallback为初始化回调接口,此接口只有一个回调方法initComplete(int result) result标识是否初始化成功,当result等于GumpSDK.CODE.OK时为成功,其他为失败 133 InitializeCallback为初始化回调接口,此接口只有一个回调方法initComplete(int result) result标识是否初始化成功,当result等于GumpSDK.CODE.OK时为成功,其他为失败
134 134
135 2.调用GumpSDK的开始方法,将执行登录流程,需要一个Activity实例作参数 135 2.调用GumpSDK的开始方法,将执行登录流程,需要一个Activity实例作参数
136 136
137 GumpSDK.start(Activity); 137 GumpSDK.start(Activity);
138 在此之前,开发者需要注册用户状态监听以接受用户的登录/登出通知,通常如下: 138 在此之前,开发者需要注册用户状态监听以接受用户的登录/登出通知,通常如下:
139 139
140 GumpSDK.setUserStateListener(new LoginStateListener() { 140 GumpSDK.setUserStateListener(new LoginStateListener() {
141 @Override 141 @Override
142 public void onLoginSuccess(GumpUser gumpUser) { 142 public void onLoginSuccess(GumpUser gumpUser) {
143 //登录成功,用户信息包含在GumpUser对象里 143 //登录成功,用户信息包含在GumpUser对象里
144 } 144 }
145 145
146 @Override 146 @Override
147 public void onLoginFailed(int code, String msg) { 147 public void onLoginFailed(int code, String msg) {
148 //登录出错,根据错误码和信息判断错误类型 148 //登录出错,根据错误码和信息判断错误类型
149 Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); 149 Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show();
150 } 150 }
151 151
152 @Override 152 @Override
153 public void onLoginCanceled() { 153 public void onLoginCanceled() {
154 //用户取消登录 154 //用户取消登录
155 Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); 155 Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show();
156 } 156 }
157 157
158 @Override 158 @Override
159 public void onLogout() { 159 public void onLogout() {
160 //用户登出 160 //用户登出
161 161
162 } 162 }
163 }); 163 });
164 164
165 如上成功登录后收到的GumpUser对象包含以下信息 165 如上成功登录后收到的GumpUser对象包含以下信息
166 166
167 gumpUser.getUid();//获取用户的userid,此Id标识唯一用户! 167 gumpUser.getUid();//获取用户的userid,此Id标识唯一用户!
168 gumpUser.getAccountType();//用户类型,此类型数据可从GumpPreference常量获取 168 gumpUser.getAccountType();//用户类型,此类型数据可从GumpPreference常量获取
169 gumpUser.getSessionKey();//登录的sesionKey 169 gumpUser.getSessionKey();//登录的sesionKey
170 170
171 171
172 3.支付功能 172 3.支付功能
173 1)使用gump通行证登录,其中除nick外所有参数为必传参数 173 1)使用gump通行证登录,其中除nick外所有参数为必传参数
174 174
175 Bundle payInfo = new Bundle(); 175 Bundle payInfo = new Bundle();
176 payInfo.putString("nick", "thi"); 176 payInfo.putString("nick", "thi");
177 payInfo.putString("product", "元宝"); 177 payInfo.putString("product", "元宝");
178 payInfo.putFloat("amount", 40.0f); 178 payInfo.putFloat("amount", 40.0f);
179 payInfo.putString("extraInfo", "This is demo!"); 179 payInfo.putString("extraInfo", "This is demo!");
180 payInfo.putString("serverId", "B4003"); 180 payInfo.putString("serverId", "B4003");
181 payInfo.putString("roleId", "10010"); 181 payInfo.putString("roleId", "10010");
182 GumpSDK.pay(MainActivity.this, payInfo,PurchaseCallback); 182 GumpSDK.pay(MainActivity.this, payInfo,PurchaseCallback);
183 调用pay方法时,必须穿入一个bundle对象,包含如上字段,除nick外所有字段必须全部包含 183 调用pay方法时,必须穿入一个bundle对象,包含如上字段,除nick外所有字段必须全部包含
184 2)未使用gump通行证登录,需要传入用户id 184 2)未使用gump通行证登录,需要传入用户id
185 185
186 Bundle payInfo = new Bundle(); 186 Bundle payInfo = new Bundle();
187 payInfo.putString("nick", "thi"); 187 payInfo.putString("nick", "thi");
188 payInfo.putString("product", "元宝"); 188 payInfo.putString("product", "元宝");
189 payInfo.putFloat("amount", 40.0f); 189 payInfo.putFloat("amount", 40.0f);
190 payInfo.putString("extraInfo", "This is demo!"); 190 payInfo.putString("extraInfo", "This is demo!");
191 payInfo.putString("serverId", "B4003"); 191 payInfo.putString("serverId", "B4003");
192 payInfo.putString("roleId", "10010"); 192 payInfo.putString("roleId", "10010");
193 GumpSDK.pay(MainActivity.this, payInfo,userId,PurchaseCallback); 193 GumpSDK.pay(MainActivity.this, payInfo,userId,PurchaseCallback);
194 194
195 PurchaseCallback为支付状态回调接口,此接口含有3个方法 195 PurchaseCallback为支付状态回调接口,此接口含有3个方法
196 196
197 @Override 197 @Override
198 public void onPurchaseCompleted(PurchaseResult result) { 198 public void onPurchaseCompleted(PurchaseResult result) {
199 Log.i(TAG,"purchase completed"); 199 Log.i(TAG,"purchase completed");
200 } 200 }
201 201
202 @Override 202 @Override
203 public void onPurchaseError(int code, String msg) { 203 public void onPurchaseError(int code, String msg) {
204 Log.i(TAG,"purchase error"); 204 Log.i(TAG,"purchase error");
205 } 205 }
206 206
207 @Override 207 @Override
208 public void onPurchaseCanceled() { 208 public void onPurchaseCanceled() {
209 Log.i(TAG,"purchase canceled"); 209 Log.i(TAG,"purchase canceled");
210 } 210 }
211 211
212 5.注销登录 212 5.注销登录
213 213
214 GumpSDK.logout(Activity); 214 GumpSDK.logout(Activity);
215 当此方法调用后,用户退出登录,并会通过LoginStateListener接口通知调用程序! 215 当此方法调用后,用户退出登录,并会通过LoginStateListener接口通知调用程序!
216 ## 第二章 常见问题 216 ## 第二章 常见问题
217 ### 问题1: 如何避免混淆对SDK的影响? 217 ### 问题1: 如何避免混淆对SDK的影响?
218 解答:有些开发者对接入了SDK的程序进行混淆时,有可能会覆盖某些java 218 解答:有些开发者对接入了SDK的程序进行混淆时,有可能会覆盖某些java
219 类,导致SDK无法正常工作,解决方法如下: 219 类,导致SDK无法正常工作,解决方法如下:
220 Ø 请开发者在混淆配置文件proguard.cfg或proguard-project.txt的最后加上 220 Ø 请开发者在混淆配置文件proguard.cfg或proguard-project.txt的最后加上
221 221
222 -keepattributes *Annotation*,InnerClasses,SourceFile,LineNumberTable 222 -keepattributes *Annotation*,InnerClasses,SourceFile,LineNumberTable
223 -keep public class * extends android.app.Service 223 -keep public class * extends android.app.Service
224 -keep public class com.google.vending.licensing.ILicensingService 224 -keep public class com.google.vending.licensing.ILicensingService
225 -keep public class com.android.vending.licensing.ILicensingService 225 -keep public class com.android.vending.licensing.ILicensingService
226 -keep class com.gumptech.sdk.view.* {*;} 226 -keep class com.gumptech.sdk.view.* {*;}
227 -keep class com.gumptech.sdk.web.* {*;} 227 -keep class com.gumptech.sdk.web.* {*;}
228 228
229 229
230 使得混淆的时候不会影响SDK的命名空间。 230 使得混淆的时候不会影响SDK的命名空间。