Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zw_game_sdk
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
CI / CD
CI / CD
流水线
日程表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
提交
问题看板
Open sidebar
zwwl
zw_game_sdk
Commits
1d96b609
提交
1d96b609
authored
5月 15, 2026
作者:
钱宇
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify:聚合sdk文档修改:回调改为callback。
上级
8d8acf2f
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
264 行增加
和
201 行删除
+264
-201
build.gradle.kts
聚合SDK/aggregation-android-sdk-demo/app/build.gradle.kts
+2
-2
MainActivity.kt
.../main/java/com/zwgame/test/gamecenterdemo/MainActivity.kt
+117
-73
接入文档.md
聚合SDK/接入文档.md
+145
-126
没有找到文件。
聚合SDK/aggregation-android-sdk-demo/app/build.gradle.kts
浏览文件 @
1d96b609
plugi
ns {
plugi
ns {
...
@@ -10,7 +10,7 @@ android {
...
@@ -10,7 +10,7 @@ android {
defaultConfig {
defaultConfig {
applicationId = "com.zwgame.test.gamecenterdemo"
applicationId = "com.zwgame.test.gamecenterdemo"
minSdk =
30
minSdk =
24
targetSdk = 36
targetSdk = 36
versionCode = 1
versionCode = 1
versionName = "1.0"
versionName = "1.0"
...
...
聚合SDK/aggregation-android-sdk-demo/app/src/main/java/com/zwgame/test/gamecenterdemo/MainActivity.kt
浏览文件 @
1d96b609
packa
ge
com.zwgame.test.gamecenterdemo
packa
ge
com.zwgame.test.gamecenterdemo
package
com.zwgame.test.gamecenterdemo
package
com.zwgame.test.gamecenterdemo
import
android.content.res.AssetManager
import
android.content.res.Resources
import
android.os.Bundle
import
android.os.Bundle
import
android.util.Log
import
android.util.Log
import
android.widget.TextView
import
android.widget.TextView
...
@@ -18,6 +16,8 @@ class MainActivity : AppCompatActivity() {
...
@@ -18,6 +16,8 @@ class MainActivity : AppCompatActivity() {
private
lateinit
var
statusText
:
TextView
private
lateinit
var
statusText
:
TextView
private
var
busy
=
false
private
var
busy
=
false
private
val
TAG
=
"gamecenter_demo"
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
WindowCompat
.
setDecorFitsSystemWindows
(
window
,
false
)
WindowCompat
.
setDecorFitsSystemWindows
(
window
,
false
)
...
@@ -50,37 +50,49 @@ class MainActivity : AppCompatActivity() {
...
@@ -50,37 +50,49 @@ class MainActivity : AppCompatActivity() {
private
fun
onInitClick
()
=
guardBusy
{
private
fun
onInitClick
()
=
guardBusy
{
statusText
.
setText
(
R
.
string
.
status_init_clicked
)
statusText
.
setText
(
R
.
string
.
status_init_clicked
)
ZySdk
.
sdkInit
(
this
)
{
result
->
ZySdk
.
sdkInit
(
this
,
true
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkInit
releaseBusy
()
Log
.
i
(
TAG
,
"sdkInit result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkInit result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(
success
)
{
val
obj
=
JSONObject
(
result
)
val
channelCode
=
obj
.
optString
(
"channelCode"
)
val
success
=
obj
.
optBoolean
(
"success"
)
Log
.
i
(
TAG
,
"init 成功,当前渠道:$channelCode"
)
if
(
success
)
{
}
else
{
val
channelCode
=
obj
.
optString
(
"channelCode"
)
Log
.
w
(
TAG
,
"init 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
Log
.
i
(
TAG
,
"init 成功,当前渠道:$channelCode"
)
}
else
{
Log
.
w
(
TAG
,
"init 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
}
}
}
}
}
)
}
}
private
fun
onLoginClick
()
=
guardBusy
{
private
fun
onLoginClick
()
=
guardBusy
{
statusText
.
setText
(
R
.
string
.
status_login_clicked
)
statusText
.
setText
(
R
.
string
.
status_login_clicked
)
ZySdk
.
sdkLogin
(
this
)
{
result
->
ZySdk
.
sdkLogin
(
this
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkLogin
releaseBusy
()
Log
.
i
(
TAG
,
"sdkLogin result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkLogin result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(!
success
)
{
val
obj
=
JSONObject
(
result
)
Log
.
w
(
TAG
,
"login 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
val
success
=
obj
.
optBoolean
(
"success"
)
if
(!
success
)
{
Log
.
w
(
TAG
,
"login 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
}
}
}
}
}
)
}
}
private
fun
onReportUserClick
()
=
guardBusy
{
private
fun
onReportUserClick
()
=
guardBusy
{
...
@@ -107,28 +119,39 @@ class MainActivity : AppCompatActivity() {
...
@@ -107,28 +119,39 @@ class MainActivity : AppCompatActivity() {
put
(
"ext"
,
""
)
put
(
"ext"
,
""
)
put
(
"playerId"
,
"1"
)
put
(
"playerId"
,
"1"
)
}.
toString
()
}.
toString
()
ZySdk
.
sdkReportRole
(
this
,
roleJson
)
{
result
->
ZySdk
.
sdkReportRole
(
this
,
roleJson
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkReportRole
releaseBusy
()
Log
.
i
(
TAG
,
"sdkReportRole result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkReportRole result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(
success
)
{
val
obj
=
JSONObject
(
result
)
Log
.
i
(
TAG
,
"reportRole 成功"
)
val
success
=
obj
.
optBoolean
(
"success"
)
}
else
{
if
(
success
)
{
Log
.
w
(
TAG
,
"reportRole 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
Log
.
i
(
TAG
,
"reportRole 成功"
)
}
else
{
Log
.
w
(
TAG
,
"reportRole 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${
obj
.
optInt
(
"errorCode"
)
}
"
)
}
}
}
}
}
)
}
}
private
fun
onUpgradeClick
()
=
guardBusy
{
private
fun
onUpgradeClick
()
=
guardBusy
{
statusText
.
setText
(
R
.
string
.
status_upgrade_clicked
)
statusText
.
setText
(
R
.
string
.
status_upgrade_clicked
)
ZySdk
.
sdkUpdate
(
this
)
{
result
->
ZySdk
.
sdkUpdate
(
this
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkUpdate
releaseBusy
()
}
if
(
isFinishing
)
return
}
})
}
}
private
fun
onPayClick
()
=
guardBusy
{
private
fun
onPayClick
()
=
guardBusy
{
...
@@ -158,55 +181,76 @@ class MainActivity : AppCompatActivity() {
...
@@ -158,55 +181,76 @@ class MainActivity : AppCompatActivity() {
put
(
"attach"
,
"sdk2_mock_attach"
)
put
(
"attach"
,
"sdk2_mock_attach"
)
put
(
"callbackUrl"
,
Constant
.
Order
.
CALLBACK_OPPO
)
put
(
"callbackUrl"
,
Constant
.
Order
.
CALLBACK_OPPO
)
}.
toString
()
}.
toString
()
ZySdk
.
sdkPay
(
this
,
payJson
)
{
result
->
ZySdk
.
sdkPay
(
this
,
payJson
,
callback
=
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkPay
releaseBusy
()
Log
.
i
(
TAG
,
"sdkPay result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkPay result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(!
success
)
{
val
obj
=
JSONObject
(
result
)
Log
.
w
(
TAG
,
"pay 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
val
success
=
obj
.
optBoolean
(
"success"
)
if
(!
success
)
{
Log
.
w
(
TAG
,
"pay 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
}
}
}
}
}
)
}
}
private
fun
onShowFloatClick
()
{
private
fun
onShowFloatClick
()
{
statusText
.
setText
(
R
.
string
.
status_show_float_clicked
)
statusText
.
setText
(
R
.
string
.
status_show_float_clicked
)
ZySdk
.
sdkShowFloat
(
this
)
{
}
ZySdk
.
sdkShowFloat
(
this
,
object
:
ZySdkCallback
{
override
fun
onResult
(
result
:
String
)
{
}
})
}
}
private
fun
onHideFloatClick
()
{
private
fun
onHideFloatClick
()
{
statusText
.
setText
(
R
.
string
.
status_hide_float_clicked
)
statusText
.
setText
(
R
.
string
.
status_hide_float_clicked
)
ZySdk
.
sdkHideFloat
(
this
)
{
}
ZySdk
.
sdkHideFloat
(
this
,
object
:
ZySdkCallback
{
override
fun
onResult
(
result
:
String
)
{
}
})
}
}
private
fun
onExitClick
()
=
guardBusy
{
private
fun
onExitClick
()
=
guardBusy
{
statusText
.
setText
(
R
.
string
.
status_exit_clicked
)
statusText
.
setText
(
R
.
string
.
status_exit_clicked
)
ZySdk
.
sdkExit
(
this
)
{
result
->
ZySdk
.
sdkExit
(
this
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkExit
releaseBusy
()
Log
.
i
(
TAG
,
"sdkExit result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkExit result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(
success
)
{
val
obj
=
JSONObject
(
result
)
Log
.
i
(
TAG
,
"用户在联运退出引导中确认退出"
)
val
success
=
obj
.
optBoolean
(
"success"
)
save
()
if
(
success
)
{
Log
.
i
(
TAG
,
"用户在联运退出引导中确认退出"
)
save
()
// exitProcess(0)
// exitProcess(0)
}
else
{
}
else
{
Log
.
i
(
TAG
,
"退出取消或失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
Log
.
i
(
TAG
,
"退出取消或失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${
obj
.
optInt
(
"errorCode"
)
}
"
)
}
}
}
}
}
)
}
}
private
fun
save
()
{
private
fun
save
()
{
//保存进度
//保存进度
}
}
private
companion
object
{
private
companion
object
{
private
const
val
TAG
=
"MainActivity"
private
const
val
TAG
=
"MainActivity"
}
}
...
...
聚合SDK/接入文档.md
浏览文件 @
1d96b609
# Gam
e Center SDK 接入说明V1.0.0.0
# Gam
e Center SDK 接入说明V1.0.0.0
...
@@ -71,33 +71,33 @@
...
@@ -71,33 +71,33 @@
```
kotlin
```
kotlin
dependencyResolutionManagement
{
dependencyResolutionManagement
{
repositories
{
repositories
{
// sdk仓库
// sdk仓库
maven
{
maven
{
url
=
uri
(
"http://nexus.zwwlkj01.top/repository/android-advertisement"
)
url
=
uri
(
"http://nexus.zwwlkj01.top/repository/android-advertisement"
)
isAllowInsecureProtocol
=
true
isAllowInsecureProtocol
=
true
credentials
{
credentials
{
username
=
""
username
=
""
password
=
""
password
=
""
}
}
}
// 巨量媒体
maven
{
url
=
uri
(
"https://artifact.bytedance.com/repository/Volcengine/"
)
}
// 建议保留
google
()
mavenCentral
()
// 打华为包时保留
maven
{
url
=
uri
(
"https://developer.huawei.com/repo/"
)
}
}
}
// 巨量媒体
maven
{
url
=
uri
(
"https://artifact.bytedance.com/repository/Volcengine/"
)
}
// 建议保留
google
()
mavenCentral
()
// 打华为包时保留
maven
{
url
=
uri
(
"https://developer.huawei.com/repo/"
)
}
}
}
}
```
```
...
@@ -125,17 +125,17 @@ implementation("com.zw.game.center:gameCenter:1.0.0.0")
...
@@ -125,17 +125,17 @@ implementation("com.zw.game.center:gameCenter:1.0.0.0")
工程级
**`build.gradle.kts`**
中,加入
工程级
**`build.gradle.kts`**
中,加入
```
kotlin
```
kotlin
buildscript
{
buildscript
{
dependencies
{
dependencies
{
classpath
(
"com.android.tools.build:gradle:8.13.2"
)
classpath
(
"com.android.tools.build:gradle:8.13.2"
)
classpath
(
"com.huawei.agconnect:agcp:1.9.5.302"
)
classpath
(
"com.huawei.agconnect:agcp:1.9.5.302"
)
}
}
}
}
```
```
app模块下添加agc插件
app模块下添加agc插件
```
kotlin
```
kotlin
plugins
{
plugins
{
id
(
"com.huawei.agconnect"
)
id
(
"com.huawei.agconnect"
)
}
}
```
```
...
@@ -149,27 +149,30 @@ plugins {
...
@@ -149,27 +149,30 @@ plugins {
在Activity进行初始化,且只初始化一次。
在Activity进行初始化,且只初始化一次。
```
kotlin
```
kotlin
ZySdk
.
sdkInit
(
activity
)
{
result
->
ZySdk
.
sdkInit
(
activity
,
true
,
object
:
ZySdkCallback
{
// 初始化结果:成功/失败信息与错误码等
override
fun
onResult
(
result
:
String
)
{
val
obj
=
JSONObject
(
result
)
// 初始化结果:成功/失败信息与错误码等
val
success
=
obj
.
optBoolean
(
"success"
)
val
obj
=
JSONObject
(
result
)
if
(
success
)
{
val
success
=
obj
.
optBoolean
(
"success"
)
val
channelCode
=
obj
.
optString
(
"channelCode"
)
if
(
success
)
{
Log
.
i
(
TAG
,
"init 成功,当前渠道:$channelCode"
)
val
channelCode
=
obj
.
optString
(
"channelCode"
)
}
else
{
Log
.
i
(
TAG
,
"init 成功,当前渠道:$channelCode"
)
val
errorMsg
=
obj
.
optString
(
"errorMsg"
)
}
else
{
val
errorCode
=
obj
.
optInt
(
"errorCode"
)
val
errorMsg
=
obj
.
optString
(
"errorMsg"
)
Log
.
w
(
TAG
,
"init 失败 errorMsg=${errorMsg} errorCode=${errorCode}"
)
val
errorCode
=
obj
.
optInt
(
"errorCode"
)
Log
.
w
(
TAG
,
"init 失败 errorMsg=${errorMsg} errorCode=${errorCode}"
)
}
}
}
}
}
)
```
```
**入参**
**入参**
| 字段 | 类型 | 含义 |
| 字段 | 类型 | 含义 |
|:----------:|:--------:|:----------------------:|
|:--------------------------:|:-------------:|:--------------------------------:|
|
`activity`
| Activity | 当前 Activity 上下文 |
|
`activity`
| Activity | 当前 Activity 上下文 |
|
`result`
| String | 初始化结果回调(JsonObject字符串) |
|
`showLoginBackgroundImage`
| Boolean | 为 true 时,登录等界面会套用在 SDK 中配置的登录背景图 |
|
`callback`
| ZySdkCallback | 初始化结果回调(JsonObject字符串) |
**回参**
**回参**
...
@@ -198,27 +201,29 @@ ZySdk.sdkInit(activity) { result ->
...
@@ -198,27 +201,29 @@ ZySdk.sdkInit(activity) { result ->
用于拉起渠道账号体系或聚合登录流程,成功返回参数请传给游戏服完成鉴权与建号。
用于拉起渠道账号体系或聚合登录流程,成功返回参数请传给游戏服完成鉴权与建号。
```
kotlin
```
kotlin
ZySdk
.
sdkLogin
(
activity
)
{
result
->
ZySdk
.
sdkLogin
(
activity
,
object
:
ZySdkCallback
{
// id、token等
override
fun
onResult
(
result
:
String
)
{
val
obj
=
JSONObject
(
result
)
// id、token等
val
success
=
obj
.
optBoolean
(
"success"
)
val
obj
=
JSONObject
(
result
)
if
(
success
)
{
val
success
=
obj
.
optBoolean
(
"success"
)
//val member_id = obj.optString("member_id")
if
(
success
)
{
Log
.
i
(
TAG
,
"成功"
)
//val member_id = obj.optString("member_id")
}
else
{
Log
.
i
(
TAG
,
"成功"
)
val
errorMsg
=
obj
.
optString
(
"errorMsg"
)
}
else
{
val
errorCode
=
obj
.
optInt
(
"errorCode"
)
val
errorMsg
=
obj
.
optString
(
"errorMsg"
)
Log
.
w
(
TAG
,
"init 失败 errorMsg=${errorMsg} errorCode=${errorCode}"
)
val
errorCode
=
obj
.
optInt
(
"errorCode"
)
}
Log
.
w
(
TAG
,
"init 失败 errorMsg=${errorMsg} errorCode=${errorCode}"
)
}
}
}
})
```
```
**入参**
**入参**
| 字段 |
类型
| 含义 |
| 字段 |
类型
| 含义 |
|:----------:|:--------:|:---------------------:|
|:----------:|:--------
-----
:|:---------------------:|
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`result`
| String
| 登录结果回调(JsonObject字符串) |
|
`callback`
| ZySdkCallback
| 登录结果回调(JsonObject字符串) |
**回参**
**回参**
...
@@ -287,26 +292,28 @@ ZySdk.sdkLogin(activity) { result ->
...
@@ -287,26 +292,28 @@ ZySdk.sdkLogin(activity) { result ->
在登录成功、切换角色等操作后需进行角色信息上报。
在登录成功、切换角色等操作后需进行角色信息上报。
```
kotlin
```
kotlin
ZySdk
.
sdkReportRole
(
activity
,
roleJson
)
{
result
->
ZySdk
.
sdkReportRole
(
activity
,
roleJson
,
object
:
ZySdkCallback
{
val
obj
=
JSONObject
(
result
)
override
fun
onResult
(
result
:
String
)
{
val
success
=
obj
.
optBoolean
(
"success"
)
val
obj
=
JSONObject
(
result
)
if
(
success
)
{
val
success
=
obj
.
optBoolean
(
"success"
)
Log
.
i
(
TAG
,
"成功"
)
if
(
success
)
{
}
else
{
Log
.
i
(
TAG
,
"成功"
)
val
errorMsg
=
obj
.
optString
(
"errorMsg"
)
}
else
{
val
errorCode
=
obj
.
optInt
(
"errorCode"
)
val
errorMsg
=
obj
.
optString
(
"errorMsg"
)
Log
.
w
(
TAG
,
"init 失败 errorMsg=${errorMsg} errorCode=${errorCode}"
)
val
errorCode
=
obj
.
optInt
(
"errorCode"
)
}
Log
.
w
(
TAG
,
"init 失败 errorMsg=${errorMsg} errorCode=${errorCode}"
)
}
}
}
})
```
```
**入参**
**入参**
| 字段 |
类型
| 含义 |
| 字段 |
类型
| 含义 |
|:----------:|:--------:|:-------------------:|
|:----------:|:--------
-----
:|:-------------------:|
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`roleJson`
|
String
| 角色信息Json字符串 |
|
`roleJson`
|
String
| 角色信息Json字符串 |
|
`result`
| String
| 结果回调(JsonObject字符串) |
|
`callback`
| ZySdkCallback
| 结果回调(JsonObject字符串) |
**roleJson参数如下:**
**roleJson参数如下:**
...
@@ -355,29 +362,31 @@ ZySdk.sdkReportRole(activity, roleJson) { result ->
...
@@ -355,29 +362,31 @@ ZySdk.sdkReportRole(activity, roleJson) { result ->
### 6. SDK支付
### 6. SDK支付
```
kotlin
```
kotlin
ZySdk
.
sdkPay
(
activity
,
payJson
)
{
result
->
ZySdk
.
sdkPay
(
activity
,
payJson
,
object
:
ZySdkCallback
{
// 购买数据、签名等
override
fun
onResult
(
result
:
String
)
{
val
obj
=
JSONObject
(
result
)
// 购买数据、签名等
val
success
=
obj
.
optBoolean
(
"success"
)
val
obj
=
JSONObject
(
result
)
if
(
success
)
{
val
success
=
obj
.
optBoolean
(
"success"
)
//val purchaseData = obj.optString("purchaseData")
if
(
success
)
{
//val purchaseDataSignature = obj.optString("purchaseDataSignature")
//val purchaseData = obj.optString("purchaseData")
Log
.
i
(
TAG
,
"成功"
)
//val purchaseDataSignature = obj.optString("purchaseDataSignature")
}
else
{
Log
.
i
(
TAG
,
"成功"
)
val
errorMsg
=
obj
.
optString
(
"errorMsg"
)
}
else
{
val
errorCode
=
obj
.
optInt
(
"errorCode"
)
val
errorMsg
=
obj
.
optString
(
"errorMsg"
)
Log
.
w
(
TAG
,
"init 失败 errorMsg=${errorMsg} errorCode=${errorCode}"
)
val
errorCode
=
obj
.
optInt
(
"errorCode"
)
}
Log
.
w
(
TAG
,
"init 失败 errorMsg=${errorMsg} errorCode=${errorCode}"
)
}
}
}
})
```
```
**入参**
**入参**
| 字段 |
类型
| 含义 |
| 字段 |
类型
| 含义 |
|:----------:|:--------:|:-------------------:|
|:----------:|:--------
-----
:|:-------------------:|
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`payJson`
|
String
| 支付信息Json字符串 |
|
`payJson`
|
String
| 支付信息Json字符串 |
|
`result`
| String
| 结果回调(JsonObject字符串) |
|
`callback`
| ZySdkCallback
| 结果回调(JsonObject字符串) |
**payJson参数如下:**
**payJson参数如下:**
...
@@ -450,22 +459,24 @@ ZySdk.sdkPay(activity, payJson) { result ->
...
@@ -450,22 +459,24 @@ ZySdk.sdkPay(activity, payJson) { result ->
在用户点击「退出游戏」等入口时调用,在回调中可实现保存进度、退出游戏等操作。
在用户点击「退出游戏」等入口时调用,在回调中可实现保存进度、退出游戏等操作。
```
kotlin
```
kotlin
ZySdk
.
sdkExit
(
activity
)
{
result
->
ZySdk
.
sdkExit
(
activity
,
object
:
ZySdkCallback
{
if
(
result
.
optBoolean
(
"success"
))
{
override
fun
onResult
(
result
:
String
)
{
save
()
//保存进度
if
(
result
.
optBoolean
(
"success"
))
{
exitProcess
(
0
)
// 结束进程
save
()
//保存进度
}
else
{
exitProcess
(
0
)
// 结束进程
// 用户取消,或失败时查看 errorMsg / errorCode
}
else
{
}
// 用户取消,或失败时查看 errorMsg / errorCode
}
}
}
})
```
```
**入参**
**入参**
| 字段 |
类型
| 含义 |
| 字段 |
类型
| 含义 |
|:----------:|:--------:|:-------------------:|
|:----------:|:--------
-----
:|:-------------------:|
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`result`
| String
| 结果回调(JsonObject字符串) |
|
`callback`
| ZySdkCallback
| 结果回调(JsonObject字符串) |
**回参**
**回参**
...
@@ -483,17 +494,19 @@ ZySdk.sdkExit(activity) { result ->
...
@@ -483,17 +494,19 @@ ZySdk.sdkExit(activity) { result ->
只需调用,若有更新,会弹出各渠道sdk自带的更新弹窗。
只需调用,若有更新,会弹出各渠道sdk自带的更新弹窗。
```
kotlin
```
kotlin
ZySdk
.
sdkUpdate
(
this
)
{
result
->
ZySdk
.
sdkUpdate
(
this
,
object
:
ZySdkCallback
{
override
fun
onResult
(
result
:
String
)
{
}
}
})
```
```
**入参**
**入参**
| 字段 |
类型
| 含义 |
| 字段 |
类型
| 含义 |
|:----------:|:--------:|:-------------------:|
|:----------:|:--------
-----
:|:-------------------:|
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`result`
| String
| 结果回调(JsonObject字符串) |
|
`callback`
| ZySdkCallback
| 结果回调(JsonObject字符串) |
**回参**
**回参**
...
@@ -510,22 +523,28 @@ ZySdk.sdkUpdate(this) { result ->
...
@@ -510,22 +523,28 @@ ZySdk.sdkUpdate(this) { result ->
显示浮窗
显示浮窗
```
kotlin
```
kotlin
ZySdk
.
sdkShowFloat
(
this
)
{
result
->
ZySdk
.
sdkShowFloat
(
this
,
object
:
ZySdkCallback
{
}
override
fun
onResult
(
result
:
String
)
{
}
})
```
```
隐藏浮窗
隐藏浮窗
```
kotlin
```
kotlin
ZySdk
.
sdkHideFloat
(
this
)
{
result
->
ZySdk
.
sdkHideFloat
(
this
,
object
:
ZySdkCallback
{
}
override
fun
onResult
(
result
:
String
)
{
}
})
```
```
**入参**
**入参**
| 字段 |
类型
| 含义 |
| 字段 |
类型
| 含义 |
|:----------:|:--------:|:-------------------:|
|:----------:|:--------
-----
:|:-------------------:|
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`activity`
|
Activity
| 当前 Activity 上下文 |
|
`result`
| String
| 结果回调(JsonObject字符串) |
|
`callback`
| ZySdkCallback
| 结果回调(JsonObject字符串) |
>该功能由各渠道sdk控制,并不一定能生效,如华为sdk调用就不会弹出浮窗。
>该功能由各渠道sdk控制,并不一定能生效,如华为sdk调用就不会弹出浮窗。
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论