xuguohong

修改聊天统计接口

...@@ -31,4 +31,7 @@ ...@@ -31,4 +31,7 @@
31 1、sdk更新和添加文件损坏处理 31 1、sdk更新和添加文件损坏处理
32 32
33 2017-07-24<br> 33 2017-07-24<br>
34 -1、添加聊天统计,修改安装标识码
...\ No newline at end of file ...\ No newline at end of file
34 +1、添加聊天统计,修改安装标识码
35 +
36 +2017-07-31<br>
37 +1、修改聊天统计接口
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -10,18 +10,17 @@ ...@@ -10,18 +10,17 @@
10 #### 1.2、复制SDK压缩包中assets目录下的所有内容到游戏工程的assets目录 #### 10 #### 1.2、复制SDK压缩包中assets目录下的所有内容到游戏工程的assets目录 ####
11 11
12 - 将游戏中的闪屏图片放到assets中poolsdk_splash目录下 12 - 将游戏中的闪屏图片放到assets中poolsdk_splash目录下
13 -- 将assets中的sdk,sdk.zip,sdkconfig.ini复制到接入工程中 13 +- 将assets中的poolsdk.xml中的`YA_APPKEY,YA_APPID,gamesimplename` 修改为后台生成的参数(必填)
14 -- 将assets中的poolsdk.xml中的`YA_APPKEY,YA_APPID,gamesimplename` 修改为后台生成的参数 14 +- channelparameter1 和 channelparameter2 为后台对应渠道编号1和2(选填)
15 -- channelparameter1 和 channelparameter2 为后台对应渠道编号1和2 15 +- custom 为自定义参数(选填)
16 -- custom 为自定义参数 16 +- gamechannelid 为游戏渠道号(选填)
17 -- gamechannelid 为游戏渠道号
18 17
19 ![](http://i.imgur.com/gcqAjL1.png) 18 ![](http://i.imgur.com/gcqAjL1.png)
20 19
21 #### 1.3、修改游戏工程的AndroidManifest.xml(可以参照复制Demo中 AndroidManifest.xml文件) #### 20 #### 1.3、修改游戏工程的AndroidManifest.xml(可以参照复制Demo中 AndroidManifest.xml文件) ####
22 21
23 - 添加声明权限: 22 - 添加声明权限:
24 -- 23 +-
25 ```xml 24 ```xml
26 <uses-permission android:name="android.permission.INTERNET" /> 25 <uses-permission android:name="android.permission.INTERNET" />
27 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 26 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
...@@ -33,7 +32,7 @@ ...@@ -33,7 +32,7 @@
33 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> 32 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
34 <uses-permission android:name="android.permission.READ_LOGS" /> 33 <uses-permission android:name="android.permission.READ_LOGS" />
35 <uses-permission android:name="android.permission.GET_TASKS" /> 34 <uses-permission android:name="android.permission.GET_TASKS" />
36 -``` 35 +```
37 36
38 - 添加对应的Activity,service,receiver等: 37 - 添加对应的Activity,service,receiver等:
39 38
...@@ -98,26 +97,11 @@ ...@@ -98,26 +97,11 @@
98 android:exported="true" 97 android:exported="true"
99 android:launchMode="singleTop" /> 98 android:launchMode="singleTop" />
100 99
101 - <uses-library
102 - android:name="org.simalliance.openmobileapi"
103 - android:required="false" />
104 -
105 - <activity
106 - android:name="com.unionpay.uppay.PayActivity"
107 - android:configChanges="orientation|keyboardHidden|keyboard"
108 - android:screenOrientation="portrait" >
109 - </activity>
110 - <activity
111 - android:name="com.unionpay.UPPayWapActivity"
112 - android:configChanges="orientation|keyboardHidden|fontScale"
113 - android:screenOrientation="portrait"
114 - android:windowSoftInputMode="adjustResize" >
115 - </activity>
116 ``` 100 ```
117 101
118 - 102 +
119 ### 2、功能接口 ### 103 ### 2、功能接口 ###
120 - 104 +
121 (注意:以下所有接口都必须在 SDK 初始化完成之后才能调用) 105 (注意:以下所有接口都必须在 SDK 初始化完成之后才能调用)
122 2.1、继承 PoolSDKApplication(必接) 106 2.1、继承 PoolSDKApplication(必接)
123 说明:<br> 107 说明:<br>
...@@ -139,88 +123,88 @@ ...@@ -139,88 +123,88 @@
139 2.2.1、方法定义 123 2.2.1、方法定义
140 public static void init(final Activity activity,final PoolSDKCallBackListener callBackListener) 124 public static void init(final Activity activity,final PoolSDKCallBackListener callBackListener)
141 2.2.2、参数说明 125 2.2.2、参数说明
142 -参数 |说明 126 +| 参数 | 说明 |
143 ------------- | ------------- 127 +| ---------------- | -------------------------------- |
144 -activity | Activity 对应 128 +| activity | Activity 对应 |
145 -callBackListener | 初始化完成回调通知,需实现 poolSdkCallBack 方法 129 +| callBackListener | 初始化完成回调通知,需实现 poolSdkCallBack 方法 |
146 130
147 2.2.3、代码示例: 131 2.2.3、代码示例:
148 PoolSdkHelper.init(this, new PoolSDKCallBackListener() { 132 PoolSdkHelper.init(this, new PoolSDKCallBackListener() {
149 - @Override 133 + @Override
150 - public void poolSdkCallBack(int code, String msg) { 134 + public void poolSdkCallBack(int code, String msg) {
151 - // TODO Auto-generated method stub 135 + // TODO Auto-generated method stub
152 - PoolSdkLog.logInfo("callback: code:" + code + "msg:" + msg); 136 + PoolSdkLog.logInfo("callback: code:" + code + "msg:" + msg);
153 - switch (code) { 137 + switch (code) {
154 - case PoolSDKCode.POOLSDK_INIT_SUCCESS:// 初始化成功 138 + case PoolSDKCode.POOLSDK_INIT_SUCCESS:// 初始化成功
155 - PoolSdkLog.logInfo("游戏中POOLSDK_INIT_SUCCESS"); 139 + PoolSdkLog.logInfo("游戏中POOLSDK_INIT_SUCCESS");
156 - login(); 140 + login();
157 - break; 141 + break;
158 - case PoolSDKCode.POOLSDK_INIT_FAIL: 142 + case PoolSDKCode.POOLSDK_INIT_FAIL:
159 - break; 143 + break;
160 - }
161 - }
162 - });
163 -
164 - 2.3、登录接口(必接)
165 - 接口说明:游戏登录时调用
166 - 2.3.1、方法定义
167 - public static void login(final String paramCustom,final PoolLoginListener poolLoginListener)
168 - 2.3.2、参数说明
169 -参数 |说明
170 ------------- | -------------
171 -paramCustom | 游戏自定义参数,可通过登录成功回调方法onLoginSuccess 中的参数PoolLoginInfo 对象的 getCustom()获取
172 -poolLoginListener | 登录结果回调通知,需实现 onLoginSuccess 方法
173 -
174 - 2.3.3、代码示例
175 - PoolSdkHelper.login("登录自定义字段", new PoolLoginListener() {
176 - @Override
177 - public void onLoginSuccess(PoolLoginInfo poolLoginInfo) {
178 - String userType = poolLoginInfo.getUserType();
179 - String timestamp = poolLoginInfo.getTimestamp();
180 - String serverSign = poolLoginInfo.getServerSign();
181 - String openId = poolLoginInfo.getOpenID();
182 - //把以上信息发送给游戏服务端做登录校验,需要其他信息请从poolLoginInfo对象中获取
183 - System.out.println("登录成功 userType = " + userType
184 - + "; timestamp = " + timestamp + "; serverSign = "
185 - + serverSign + "; openId = " + openId);
186 - }
187 - @Override
188 - public void onLoginFailed(String errorMsg) {
189 - System.out.println("登录失败 = " + errorMsg);
190 } 144 }
191 - }); 145 + }
192 - 146 + });
193 - 2.4、提交角色数据接口(必接) 147 +
194 - 接口说明:游戏提交角色数据接口,该接口需要在以下 3 中情况下 148 + 2.3、登录接口(必接)
195 - 调用:进入游戏主场景、创建角色、角色升级 149 + 接口说明:游戏登录时调用
196 - 2.4.1、方法定义 150 + 2.3.1、方法定义
197 - public static void submitRoleData(final PoolRoleInfo poolRoleInfo, 151 + public static void login(final String paramCustom,final PoolLoginListener poolLoginListener)
152 + 2.3.2、参数说明
153 +| 参数 | 说明 |
154 +| ----------------- | ---------------------------------------- |
155 +| paramCustom | 游戏自定义参数,可通过登录成功回调方法onLoginSuccess 中的参数PoolLoginInfo 对象的 getCustom()获取 |
156 +| poolLoginListener | 登录结果回调通知,需实现 onLoginSuccess 方法 |
157 +
158 + 2.3.3、代码示例
159 + PoolSdkHelper.login("登录自定义字段", new PoolLoginListener() {
160 + @Override
161 + public void onLoginSuccess(PoolLoginInfo poolLoginInfo) {
162 + String userType = poolLoginInfo.getUserType();
163 + String timestamp = poolLoginInfo.getTimestamp();
164 + String serverSign = poolLoginInfo.getServerSign();
165 + String openId = poolLoginInfo.getOpenID();
166 + //把以上信息发送给游戏服务端做登录校验,需要其他信息请从poolLoginInfo对象中获取
167 + System.out.println("登录成功 userType = " + userType
168 + + "; timestamp = " + timestamp + "; serverSign = "
169 + + serverSign + "; openId = " + openId);
170 + }
171 + @Override
172 + public void onLoginFailed(String errorMsg) {
173 + System.out.println("登录失败 = " + errorMsg);
174 + }
175 + });
176 +
177 + 2.4、提交角色数据接口(必接)
178 + 接口说明:游戏提交角色数据接口,该接口需要在以下 3 中情况下
179 + 调用:进入游戏主场景、创建角色、角色升级(如果游戏创建角色时没有角色名,需要在用户创建角色名时调用多一次进入游戏统计,否则用户名无法正常统计,投放测试无法通过)
180 + 2.4.1、方法定义
181 + public static void submitRoleData(final PoolRoleInfo poolRoleInfo,
198 final PoolRoleListener poolRoleListener) 182 final PoolRoleListener poolRoleListener)
199 2.4.2、参数说明 183 2.4.2、参数说明
200 -参数 |说明 184 +| 参数 | 说明 |
201 ------------- | ------------- 185 +| ---------------- | ---------------- |
202 -poolRoleInfo | 角色数据实体类 186 +| poolRoleInfo | 角色数据实体类 |
203 -poolRoleListener | 角色数据提交结果回调通知,需实现 187 +| poolRoleListener | 角色数据提交结果回调通知,需实现 |
204 - 188 +
205 PoolRoleInfo 实体类字段说明 189 PoolRoleInfo 实体类字段说明
206 -字段名 |说明 190 +| 字段名 | 说明 |
207 ------------- | ------------- 191 +| -------------- | ---------------------------------------- |
208 -callType | 调用类型Type_EnterGame 登录游戏主 场景;Type_CreatRole 为创建角 色;Type_RoleUpgrade 为角色升级 192 +| callType | 调用类型Type_EnterGame 登录游戏主 场景;Type_CreatRole 为创建角 色;Type_RoleUpgrade 为角色升级 |
209 -roleId | 角色 Id 193 +| roleId | 角色 Id |
210 -roleName | 角色名称 194 +| roleName | 角色名称 |
211 -roleLevel | 角色等级 195 +| roleLevel | 角色等级 |
212 -roleSex | 角色性别(1 男 0 女,如果角 色不分性别请填写 0) 196 +| roleSex | 角色性别(1 男 0 女,如果角 色不分性别请填写 0) |
213 -serverId | 服务器 id 197 +| serverId | 服务器 id |
214 -serverName | 服务器名称 198 +| serverName | 服务器名称 |
215 -custom | 自定义字段 199 +| custom | 自定义字段 |
216 -roleCTime | 角色创建时间(秒) 200 +| roleCTime | 角色创建时间(秒) |
217 -partyName | 公会名称 201 +| partyName | 公会名称 |
218 -roleType | 角色类型 202 +| roleType | 角色类型 |
219 -roleChangeTime | 角色等级更新时间(以秒为单位) 203 +| roleChangeTime | 角色等级更新时间(以秒为单位) |
220 -vipLevel | VIP等级 204 +| vipLevel | VIP等级 |
221 -diamond | 余额 205 +| diamond | 余额 |
222 -moneyType | 商品单位 206 +| moneyType | 商品单位 |
223 - 207 +
224 2.4.3、代码示例 208 2.4.3、代码示例
225 /******************************************** 209 /********************************************
226 * 以下所有字段都是必填项 210 * 以下所有字段都是必填项
...@@ -243,7 +227,7 @@ moneyType | 商品单位 ...@@ -243,7 +227,7 @@ moneyType | 商品单位
243 poolRoleInfo.setCallType(PoolRoleInfo.Type_EnterGame); 227 poolRoleInfo.setCallType(PoolRoleInfo.Type_EnterGame);
244 // poolRoleInfo.setCallType(PoolRoleInfo.Type_CreateRole); 228 // poolRoleInfo.setCallType(PoolRoleInfo.Type_CreateRole);
245 // poolRoleInfo.setCallType(PoolRoleInfo.Type_RoleUpgrade); 229 // poolRoleInfo.setCallType(PoolRoleInfo.Type_RoleUpgrade);
246 - 230 +
247 PoolSdkHelper.submitRoleData(poolRoleInfo, new PoolRoleListener() { 231 PoolSdkHelper.submitRoleData(poolRoleInfo, new PoolRoleListener() {
248 @Override 232 @Override
249 public void onRoleDataSuccess(String paramCustom) { 233 public void onRoleDataSuccess(String paramCustom) {
...@@ -255,25 +239,25 @@ moneyType | 商品单位 ...@@ -255,25 +239,25 @@ moneyType | 商品单位
255 2.5.1、方法定义 239 2.5.1、方法定义
256 public static void pay(final PoolPayInfo poolPayInfo,final PoolPayListener poolPayListener) 240 public static void pay(final PoolPayInfo poolPayInfo,final PoolPayListener poolPayListener)
257 2.5.2、参数说明 241 2.5.2、参数说明
258 -参数 |说明 242 +| 参数 | 说明 |
259 ------------- | ------------- 243 +| ---------------- | ---------------- |
260 -poolRoleInfo | 角色数据实体类 244 +| poolRoleInfo | 角色数据实体类 |
261 -poolRoleListener | 角色数据提交结果回调通知,需实现 245 +| poolRoleListener | 角色数据提交结果回调通知,需实现 |
262 - 246 +
263 支付信息实体类(PoolPayInfo)字段说明 247 支付信息实体类(PoolPayInfo)字段说明
264 -参数 |说明 248 +| 参数 | 说明 |
265 ------------- | ------------- 249 +| ----------- | ------------------- |
266 -amount | 金额(单位元,必须大于 0) 250 +| amount | 金额(单位元,必须大于 0) |
267 -productId | 商品 ID(如果没有可以传空字符 串) 251 +| productId | 商品 ID(如果没有可以传空字符 串) |
268 -productName | 商品描述 252 +| productName | 商品描述 |
269 -roleid | 角色 id 253 +| roleid | 角色 id |
270 -rolelevel | 角色等级 254 +| rolelevel | 角色等级 |
271 -roleName | 角色名称 255 +| roleName | 角色名称 |
272 -serverId | 服务器 id 256 +| serverId | 服务器 id |
273 -serverName | 服务器名称 257 +| serverName | 服务器名称 |
274 -exchange | 游戏币与人民币(元)的兑换比例 258 +| exchange | 游戏币与人民币(元)的兑换比例 |
275 -custom | 自定义透传参数,通过回调函数原样返回 259 +| custom | 自定义透传参数,通过回调函数原样返回 |
276 - 260 +
277 2.5.3、代码示例 261 2.5.3、代码示例
278 /******************************************** 262 /********************************************
279 * 以下所有字段都是必填项 263 * 以下所有字段都是必填项
...@@ -282,48 +266,48 @@ custom | 自定义透传参数,通过回调函数原样返回 ...@@ -282,48 +266,48 @@ custom | 自定义透传参数,通过回调函数原样返回
282 poolPayInfo.setAmount("1"); 266 poolPayInfo.setAmount("1");
283 // 服务器id 267 // 服务器id
284 poolPayInfo.setServerID("8"); 268 poolPayInfo.setServerID("8");
285 - // 服务器名 269 + // 服务器名
286 - poolPayInfo.setServerName("我是服务器名"); 270 + poolPayInfo.setServerName("我是服务器名");
287 - // 角色id 271 + // 角色id
288 - poolPayInfo.setRoleID("123456"); 272 + poolPayInfo.setRoleID("123456");
289 - // 角色名 273 + // 角色名
290 - poolPayInfo.setRoleName("我是角色名"); 274 + poolPayInfo.setRoleName("我是角色名");
291 - // 角色等级 275 + // 角色等级
292 - poolPayInfo.setRoleLevel("10"); 276 + poolPayInfo.setRoleLevel("10");
293 - // 商品ID 277 + // 商品ID
294 - poolPayInfo.setProductID("1"); 278 + poolPayInfo.setProductID("1");
295 - // 商品名称 279 + // 商品名称
296 - poolPayInfo.setProductName("金币"); 280 + poolPayInfo.setProductName("金币");
297 - // 商品描述 281 + // 商品描述
298 - poolPayInfo.setProductDesc("购买金币"); 282 + poolPayInfo.setProductDesc("购买金币");
299 - // 兑换比例 283 + // 兑换比例
300 - poolPayInfo.setExchange("10"); 284 + poolPayInfo.setExchange("10");
301 - // 自定义参数 285 + // 自定义参数
302 - poolPayInfo.setCustom("我是自定义参数"); 286 + poolPayInfo.setCustom("我是自定义参数");
303 - // TODO Auto-generated method stub 287 + // TODO Auto-generated method stub
304 - PoolSdkHelper.pay(poolPayInfo, new PoolPayListener() { 288 + PoolSdkHelper.pay(poolPayInfo, new PoolPayListener() {
305 - @Override 289 + @Override
306 - public void onPaySuccess(String paramCustom) { 290 + public void onPaySuccess(String paramCustom) {
307 - System.out.println("支付成功 = " + paramCustom); 291 + System.out.println("支付成功 = " + paramCustom);
308 - } 292 + }
309 - @Override 293 + @Override
310 - public void onPayFailed(String paramCustom, String errorMsg) { 294 + public void onPayFailed(String paramCustom, String errorMsg) {
311 - System.out.println("支付失败 = " + paramCustom + "; errorMsg = " 295 + System.out.println("支付失败 = " + paramCustom + "; errorMsg = "
312 - + errorMsg); 296 + + errorMsg);
313 - } 297 + }
314 - }); 298 + });
315 - 299 +
316 - 2.6、检测 SDK 是否含有用户中心接口(必接) 300 + 2.6、检测 SDK 是否含有用户中心接口(必接)
317 - 说明:如果接口返回为 true,表示需要游戏方在合适的界面中添加一个用户中心的按钮,点击按钮时调用文 301 + 说明:如果接口返回为 true,表示需要游戏方在合适的界面中添加一个用户中心的按钮,点击按钮时调用文
318 - 档中 2.7 的用户中心接口;如果返回 false,则不做处理 302 + 档中 2.7 的用户中心接口;如果返回 false,则不做处理
319 - 2.6.1、方法定义 303 + 2.6.1、方法定义
320 - public static boolean hasChannelCenter() 304 + public static boolean hasChannelCenter()
321 - 2.7、用户中心接口(必接) 305 + 2.7、用户中心接口(必接)
322 - 说明:打开渠道用户中心界面 306 + 说明:打开渠道用户中心界面
323 - 2.7.1、方法定义 307 + 2.7.1、方法定义
324 - public static void openChannelCenter() 308 + public static void openChannelCenter()
325 - 2.7.2、代码示例 309 + 2.7.2、代码示例
326 - /** 310 + /**
327 * 用户中心 311 * 用户中心
328 * 312 *
329 * 游戏方先调用PoolSdkHelper.hasChannelCenter()获取是否有用户中心, 313 * 游戏方先调用PoolSdkHelper.hasChannelCenter()获取是否有用户中心,
...@@ -335,14 +319,14 @@ custom | 自定义透传参数,通过回调函数原样返回 ...@@ -335,14 +319,14 @@ custom | 自定义透传参数,通过回调函数原样返回
335 } 319 }
336 320
337 2.8、注销登录监听接口 321 2.8、注销登录监听接口
338 - 说明:可在游戏启动时设置注销监听事件,渠道注销成功后 SDK 会回调 onLogoutSuccess 方法通知游戏,游戏可在此处理切换账号逻辑 322 + 说明:可在游戏启动时设置注销监听事件,渠道注销成功后 SDK 会回调 onLogoutSuccess 方法通知游戏,游戏可在此处理切换账号逻辑
339 - 2.8.1、方法定义 323 + 2.8.1、方法定义
340 - public static void setLogoutCallback(final PoolLogoutListener poolLogoutListener) 324 + public static void setLogoutCallback(final PoolLogoutListener poolLogoutListener)
341 - 2.8.2、参数说明 325 + 2.8.2、参数说明
342 -参数 |说明 326 +| 参数 | 说明 |
343 ------------- | ------------- 327 +| ------------------ | --------------------------------- |
344 -poolLogoutListener | 账户注销成功回调监听,需实现 onLogoutSuccess 方法 328 +| poolLogoutListener | 账户注销成功回调监听,需实现 onLogoutSuccess 方法 |
345 - 329 +
346 2.8.3、代码示例 330 2.8.3、代码示例
347 PoolSdkHelper.setLogoutCallback(new PoolLogoutListener() { 331 PoolSdkHelper.setLogoutCallback(new PoolLogoutListener() {
348 @Override 332 @Override
...@@ -352,7 +336,7 @@ poolLogoutListener | 账户注销成功回调监听,需实现 onLogoutSuccess ...@@ -352,7 +336,7 @@ poolLogoutListener | 账户注销成功回调监听,需实现 onLogoutSuccess
352 PoolSdkLog.logInfo("游戏中logoutSuccess"); 336 PoolSdkLog.logInfo("游戏中logoutSuccess");
353 } 337 }
354 }); 338 });
355 - 339 +
356 2.9、退出游戏接口(必接) 340 2.9、退出游戏接口(必接)
357 说明:在游戏需要退出时调用,调用此接口时需先用 PoolSdkHelper.hasExitDialog() 判断 sdk 是否有退出界 341 说明:在游戏需要退出时调用,调用此接口时需先用 PoolSdkHelper.hasExitDialog() 判断 sdk 是否有退出界
358 面,为 true表示有退出界面需调用 showExitDialog()显示退出界面,为 false 时表示没有退出界面,游戏需自己处 342 面,为 true表示有退出界面需调用 showExitDialog()显示退出界面,为 false 时表示没有退出界面,游戏需自己处
...@@ -360,146 +344,146 @@ poolLogoutListener | 账户注销成功回调监听,需实现 onLogoutSuccess ...@@ -360,146 +344,146 @@ poolLogoutListener | 账户注销成功回调监听,需实现 onLogoutSuccess
360 2.9.1、方法定义 344 2.9.1、方法定义
361 public static void showExitDialog(final PoolExitDialogListener exitDialogListener) 345 public static void showExitDialog(final PoolExitDialogListener exitDialogListener)
362 2.9.2、参数说明 346 2.9.2、参数说明
363 - 参数 |说明 347 +| 参数 | 说明 |
364 ------------- | ------------- 348 +| ------------------ | ------------------------------ |
365 -exitDialogListener | 退出结果回调监听,需实现 onDialogResult 方法 349 +| exitDialogListener | 退出结果回调监听,需实现 onDialogResult 方法 |
350 +
366 351
367 -
368 2.9.3、代码示例 352 2.9.3、代码示例
369 @Override 353 @Override
370 - public boolean dispatchKeyEvent(KeyEvent pKeyEvent) { 354 + public boolean dispatchKeyEvent(KeyEvent pKeyEvent) {
371 - if (pKeyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK 355 + if (pKeyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK
372 - && pKeyEvent.getAction() == KeyEvent.ACTION_DOWN) { 356 + && pKeyEvent.getAction() == KeyEvent.ACTION_DOWN) {
373 - if (PoolSdkHelper.hasExitDialog()) { 357 + if (PoolSdkHelper.hasExitDialog()) {
374 - PoolSdkHelper.showExitDialog(new PoolExitDialogListener() { 358 + PoolSdkHelper.showExitDialog(new PoolExitDialogListener() {
375 - @Override 359 + @Override
376 - public void onDialogResult(int code, String msg) { 360 + public void onDialogResult(int code, String msg) {
377 - // TODO Auto-generated method stub 361 + // TODO Auto-generated method stub
378 - switch (code) { 362 + switch (code) {
379 - case PoolSDKCode.EXIT_SUCCESS:// 退出成功游戏处理自己退出逻辑 363 + case PoolSDKCode.EXIT_SUCCESS:// 退出成功游戏处理自己退出逻辑
380 - finish(); 364 + finish();
381 - // System.exit(0); 365 + // System.exit(0);
382 - break; 366 + break;
383 - case PoolSDKCode.EXIT_CANCEL:// 取消退出 367 + case PoolSDKCode.EXIT_CANCEL:// 取消退出
384 - break; 368 + break;
385 - default: 369 + default:
386 - break; 370 + break;
387 - } 371 + }
388 - } 372 + }
389 - }); 373 + });
390 - } else { 374 + } else {
391 - // TODO: 调用游戏的退出界面 375 + // TODO: 调用游戏的退出界面
392 - showGameExitTips(); 376 + showGameExitTips();
393 - } 377 + }
394 - return false; 378 + return false;
395 - } 379 + }
396 - return super.dispatchKeyEvent(pKeyEvent); 380 + return super.dispatchKeyEvent(pKeyEvent);
397 - } 381 + }
398 2.10、Android 生命周期接口(必接) 382 2.10、Android 生命周期接口(必接)
399 说明:在游戏 Activity 的 onStart、onPause、onResume、 onStop、onDestroy、onRestart、onNewIntent、 onActivityResult、onConfigurationChanged、onSaveInstanceState、onRestoreInstanceState、onWindowFocusChanged、onWindowAttributesChanged 中分别调用对应的接口 383 说明:在游戏 Activity 的 onStart、onPause、onResume、 onStop、onDestroy、onRestart、onNewIntent、 onActivityResult、onConfigurationChanged、onSaveInstanceState、onRestoreInstanceState、onWindowFocusChanged、onWindowAttributesChanged 中分别调用对应的接口
400 2.10.1、代码示例 384 2.10.1、代码示例
401 @Override 385 @Override
402 - public void onStart() { 386 + public void onStart() {
403 - super.onStart(); 387 + super.onStart();
404 - PoolSdkHelper.onStart(); 388 + PoolSdkHelper.onStart();
405 - } 389 + }
406 - 390 +
407 - @Override 391 + @Override
408 - public void onStop() { 392 + public void onStop() {
409 - super.onStop(); 393 + super.onStop();
410 - PoolSdkHelper.onStop(); 394 + PoolSdkHelper.onStop();
411 - } 395 + }
412 - 396 +
413 - @Override 397 + @Override
414 - public void onDestroy() { 398 + public void onDestroy() {
415 - super.onDestroy(); 399 + super.onDestroy();
416 - PoolSdkHelper.onDestroy(); 400 + PoolSdkHelper.onDestroy();
417 - } 401 + }
418 - 402 +
419 - @Override 403 + @Override
420 - public void onResume() { 404 + public void onResume() {
421 - super.onResume(); 405 + super.onResume();
422 - PoolSdkHelper.onResume(); 406 + PoolSdkHelper.onResume();
423 - } 407 + }
424 - 408 +
425 - @Override 409 + @Override
426 - public void onPause() { 410 + public void onPause() {
427 - super.onPause(); 411 + super.onPause();
428 - PoolSdkHelper.onPause(); 412 + PoolSdkHelper.onPause();
429 - } 413 + }
430 - 414 +
431 - @Override 415 + @Override
432 - public void onRestart() { 416 + public void onRestart() {
433 - super.onRestart(); 417 + super.onRestart();
434 - PoolSdkHelper.onRestart(); 418 + PoolSdkHelper.onRestart();
435 - } 419 + }
436 - 420 +
437 - @Override 421 + @Override
438 - public void onNewIntent(Intent intent) { 422 + public void onNewIntent(Intent intent) {
439 - super.onNewIntent(intent); 423 + super.onNewIntent(intent);
440 - PoolSdkHelper.onNewIntent(intent); 424 + PoolSdkHelper.onNewIntent(intent);
441 - } 425 + }
442 - 426 +
443 - @Override 427 + @Override
444 - protected void onActivityResult(int requestCode, int resultCode, Intent data) { 428 + protected void onActivityResult(int requestCode, int resultCode, Intent data) {
445 - PoolSdkHelper.onActivityResult(requestCode, resultCode, data); 429 + PoolSdkHelper.onActivityResult(requestCode, resultCode, data);
446 - } 430 + }
447 - 431 +
448 - @Override 432 + @Override
449 - public void onConfigurationChanged(Configuration newConfig) { 433 + public void onConfigurationChanged(Configuration newConfig) {
450 - // TODO Auto-generated method stub 434 + // TODO Auto-generated method stub
451 - super.onConfigurationChanged(newConfig); 435 + super.onConfigurationChanged(newConfig);
452 - PoolSdkHelper.onConfigurationChanged(newConfig); 436 + PoolSdkHelper.onConfigurationChanged(newConfig);
453 - } 437 + }
454 - 438 +
455 - @Override 439 + @Override
456 - protected void onSaveInstanceState(Bundle outState) { 440 + protected void onSaveInstanceState(Bundle outState) {
457 - // TODO Auto-generated method stub 441 + // TODO Auto-generated method stub
458 - super.onSaveInstanceState(outState); 442 + super.onSaveInstanceState(outState);
459 - PoolSdkHelper.onSaveInstanceState(outState); 443 + PoolSdkHelper.onSaveInstanceState(outState);
460 - } 444 + }
461 - 445 +
462 - @Override 446 + @Override
463 - protected void onRestoreInstanceState(Bundle savedInstanceState) { 447 + protected void onRestoreInstanceState(Bundle savedInstanceState) {
464 - // TODO Auto-generated method stub 448 + // TODO Auto-generated method stub
465 - super.onRestoreInstanceState(savedInstanceState); 449 + super.onRestoreInstanceState(savedInstanceState);
466 - PoolSdkHelper.onRestoreInstanceState(savedInstanceState); 450 + PoolSdkHelper.onRestoreInstanceState(savedInstanceState);
467 - } 451 + }
468 - 452 +
469 - @Override 453 + @Override
470 - public void onWindowFocusChanged(boolean hasFocus) { 454 + public void onWindowFocusChanged(boolean hasFocus) {
471 - // TODO Auto-generated method stub 455 + // TODO Auto-generated method stub
472 - super.onWindowFocusChanged(hasFocus); 456 + super.onWindowFocusChanged(hasFocus);
473 - PoolSdkHelper.onWindowFocusChanged(hasFocus); 457 + PoolSdkHelper.onWindowFocusChanged(hasFocus);
474 - } 458 + }
475 - 459 +
476 - @Override 460 + @Override
477 - public void onWindowAttributesChanged(LayoutParams params) { 461 + public void onWindowAttributesChanged(LayoutParams params) {
478 - // TODO Auto-generated method stub 462 + // TODO Auto-generated method stub
479 - super.onWindowAttributesChanged(params); 463 + super.onWindowAttributesChanged(params);
480 - PoolSdkHelper.onWindowAttributesChanged(params); 464 + PoolSdkHelper.onWindowAttributesChanged(params);
481 - } 465 + }
482 - 466 +
483 2.11、扩展接口(可选) 467 2.11、扩展接口(可选)
484 说明:该接口为扩展的万能接口,留作备用,目前游戏方可以不接入 468 说明:该接口为扩展的万能接口,留作备用,目前游戏方可以不接入
485 2.11.1、方法定义 469 2.11.1、方法定义
486 public static void expansionInterface(final String paramCustom,final PoolExpansionListener poolExpansionListener) 470 public static void expansionInterface(final String paramCustom,final PoolExpansionListener poolExpansionListener)
487 2.11.2、参数说明 471 2.11.2、参数说明
488 - 参数 |说明 472 +| 参数 | 说明 |
489 ------------- | ------------- 473 +| --------------------- | -------------------- |
490 -paramCustom | 自定义参数 474 +| paramCustom | 自定义参数 |
491 -poolExpansionListener | 方法回调参数,实现onSuccess方法 475 +| poolExpansionListener | 方法回调参数,实现onSuccess方法 |
492 - 476 +
493 2.12、获取渠道包标识(可选) 477 2.12、获取渠道包标识(可选)
494 接口名称:PoolSdkHelper.getGameChannelId() 478 接口名称:PoolSdkHelper.getGameChannelId()
495 - 接口说明:获取在企业平台配置的渠道标识,返回类型为 String 479 + 接口说明:获取在企业平台配置的渠道标识,返回类型为 String
496 - 接口名称:PoolSdkHelper. getChannelParameter1 () 480 + 接口名称:PoolSdkHelper. getChannelParameter1 ()
497 - 接口说明:获取在企业平台配置的渠道参数 1,返回类型为 String 481 + 接口说明:获取在企业平台配置的渠道参数 1,返回类型为 String
498 - 接口名称:PoolSdkHelper. getChannelParameter2 () 482 + 接口名称:PoolSdkHelper. getChannelParameter2 ()
499 - 接口说明:获取在企业平台配置的渠道参数 2,返回类型为 String 483 + 接口说明:获取在企业平台配置的渠道参数 2,返回类型为 String
500 2.13、获取渠道自定义参数(可选) 484 2.13、获取渠道自定义参数(可选)
501 接口名称:PoolSdkHelper.getCustomValue() 485 接口名称:PoolSdkHelper.getCustomValue()
502 - 接口说明:获取在企业平台配置的渠道自定义参数,返回类型为 String 486 + 接口说明:获取在企业平台配置的渠道自定义参数,返回类型为 String
503 2.14、打开论坛接口(UC 平台专用) 487 2.14、打开论坛接口(UC 平台专用)
504 接口名称:PoolSkHelper.openForum() 488 接口名称:PoolSkHelper.openForum()
505 接口说明:打开渠道的论坛界面 489 接口说明:打开渠道的论坛界面
...@@ -508,10 +492,10 @@ poolExpansionListener | 方法回调参数,实现onSuccess方法 ...@@ -508,10 +492,10 @@ poolExpansionListener | 方法回调参数,实现onSuccess方法
508 2.15.1、方法定义 492 2.15.1、方法定义
509 public static void logout(final Activity paramActivity) ; 493 public static void logout(final Activity paramActivity) ;
510 2.15.2、参数说明 494 2.15.2、参数说明
511 -参数 |说明 495 +| 参数 | 说明 |
512 ------------- | ------------- 496 +| ------------- | ---- |
513 -paramActivity | 上下文 497 +| paramActivity | 上下文 |
514 - 498 +
515 2.15.3、代码示例 499 2.15.3、代码示例
516 private void logout(){ 500 private void logout(){
517 if(PoolSdkHelper.hasLogout()){ 501 if(PoolSdkHelper.hasLogout()){
...@@ -523,9 +507,9 @@ paramActivity | 上下文 ...@@ -523,9 +507,9 @@ paramActivity | 上下文
523 2.16.1、方法定义 507 2.16.1、方法定义
524 public static void switchAccount(final Activity paramActivity); 508 public static void switchAccount(final Activity paramActivity);
525 2.16.2、参数说明 509 2.16.2、参数说明
526 -参数 |说明 510 +| 参数 | 说明 |
527 ------------- | ------------- 511 +| ------------- | ---- |
528 -paramActivity | 上下文 512 +| paramActivity | 上下文 |
529 513
530 2.16.3、代码示例 514 2.16.3、代码示例
531 /** 515 /**
...@@ -536,22 +520,21 @@ paramActivity | 上下文 ...@@ -536,22 +520,21 @@ paramActivity | 上下文
536 PoolSdkHelper.switchAccount(this); 520 PoolSdkHelper.switchAccount(this);
537 } 521 }
538 } 522 }
539 -
540 523
541 2.17、聊天统计 524 2.17、聊天统计
542 说明:在用户发送聊天信息时调用改接口 525 说明:在用户发送聊天信息时调用改接口
543 - 方法:public static void reportChat(final String content, final String accountId,final String accountName, final int level, final String serverId,final String serverName) 526 + 方法:public static void reportChat(final String content,String type, final String accountId,final String accountName, final int level, final String serverId,final String serverName)
544 参数说明: 527 参数说明:
545 参数 |说明 528 参数 |说明
546 ------------ | ------------- 529 ------------ | -------------
547 content | 聊天内容 530 content | 聊天内容
531 +type | 聊天类型(世界,私聊等)
548 accountId | 角色ID 532 accountId | 角色ID
549 accountName | 角色名称 533 accountName | 角色名称
550 level | 角色等级 534 level | 角色等级
551 serverId | 服务器ID 535 serverId | 服务器ID
552 serverName | 服务器名称 536 serverName | 服务器名称
553 537
554 -
555 # 3、自测用例 # 538 # 3、自测用例 #
556 ### 3.1、进入游戏会弹出下面的登录界面,表示登录接口接入正常; ### 539 ### 3.1、进入游戏会弹出下面的登录界面,表示登录接口接入正常; ###
557 540
...@@ -568,4 +551,4 @@ serverName | 服务器名称 ...@@ -568,4 +551,4 @@ serverName | 服务器名称
568 - 后台配置正确的游戏充值回调地址可以进行充值测试是否到账 551 - 后台配置正确的游戏充值回调地址可以进行充值测试是否到账
569 552
570 # 4、母包 # 553 # 4、母包 #
571 - 4.1、接入公共 SDK 编译生成的 apk 即为打包工具使用的母包 554 + 4.1、接入公共 SDK 编译生成的 apk 即为打包工具使用的母包(可以删掉assets下的data.bin,libs下的SDK相关so库,YouaiSDK.jar)
......