提交 1286dbad 作者: 钱宇

modify:聚合SDK文档修改。

上级 0aaa5fe4
plugins { plugins {
...@@ -79,5 +79,5 @@ dependencies { ...@@ -79,5 +79,5 @@ dependencies {
androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(libs.androidx.espresso.core)
implementation("com.zw.game.center:gameCenter:1.0.0.4") implementation("com.zw.game.center:gameCenter:1.0.0.3")
} }
\ No newline at end of file
package com.zwgame.test.gamecenterdemo package com.zwgame.test.gamecenterdemo
...@@ -59,7 +59,8 @@ class MainActivity : AppCompatActivity() { ...@@ -59,7 +59,8 @@ class MainActivity : AppCompatActivity() {
val obj = JSONObject(result) val obj = JSONObject(result)
val success = obj.optBoolean("success") val success = obj.optBoolean("success")
if (success) { if (success) {
Log.i(TAG, "init 成功") val channelCode = obj.optString("channelCode")
Log.i(TAG, "init 成功,当前渠道:$channelCode")
} else { } else {
Log.w(TAG, "init 失败 errorMsg=${obj.optString("errorMsg")} errorCode=${obj.optInt("errorCode")}") Log.w(TAG, "init 失败 errorMsg=${obj.optString("errorMsg")} errorCode=${obj.optInt("errorCode")}")
} }
...@@ -173,12 +174,12 @@ class MainActivity : AppCompatActivity() { ...@@ -173,12 +174,12 @@ class MainActivity : AppCompatActivity() {
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.showHuaweiFloat(this) { }
} }
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.hideHuaweiFloat(this) { }
} }
private fun onExitClick() = guardBusy { private fun onExitClick() = guardBusy {
......
package com.zwgame.test.gamecenterdemo; package com.zwgame.test.gamecenterdemo;
...@@ -68,7 +68,8 @@ public class MainJavaActivity extends AppCompatActivity { ...@@ -68,7 +68,8 @@ public class MainJavaActivity extends AppCompatActivity {
JSONObject obj = new JSONObject(result); JSONObject obj = new JSONObject(result);
boolean success = obj.optBoolean("success"); boolean success = obj.optBoolean("success");
if (success) { if (success) {
Log.i(TAG, "init 成功"); String channelCode = obj.optString("channelCode");
Log.i(TAG, "init 成功,当前渠道:" + channelCode);
} else { } else {
Log.w(TAG, "init 失败 errorMsg=" + obj.optString("errorMsg") + " errorCode=" + obj.optInt("errorCode")); Log.w(TAG, "init 失败 errorMsg=" + obj.optString("errorMsg") + " errorCode=" + obj.optInt("errorCode"));
} }
...@@ -217,12 +218,12 @@ public class MainJavaActivity extends AppCompatActivity { ...@@ -217,12 +218,12 @@ public class MainJavaActivity extends AppCompatActivity {
private void onShowFloatClick() { private void onShowFloatClick() {
statusText.setText(R.string.status_show_float_clicked); statusText.setText(R.string.status_show_float_clicked);
ZySdk.INSTANCE.sdkShowFloat(this, (Function1<String, Unit>) result -> Unit.INSTANCE); ZySdk.INSTANCE.showHuaweiFloat(this, (Function1<String, Unit>) result -> Unit.INSTANCE);
} }
private void onHideFloatClick() { private void onHideFloatClick() {
statusText.setText(R.string.status_hide_float_clicked); statusText.setText(R.string.status_hide_float_clicked);
ZySdk.INSTANCE.sdkHideFloat(this, (Function1<String, Unit>) result -> Unit.INSTANCE); ZySdk.INSTANCE.hideHuaweiFloat(this, (Function1<String, Unit>) result -> Unit.INSTANCE);
} }
private void onExitClick() { private void onExitClick() {
......
# Game Center SDK 接入说明V1.0.0.0 # Game Center SDK 接入说明V1.0.0.0
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<a name="overview-features"></a> <a name="overview-features"></a>
### 1. 主要功能 ### 1. 主要功能
* SDK初始化 * SDK初始化
* SDK登录 * SDK登录
* SDK角色信息上报 * SDK角色信息上报
...@@ -37,14 +37,14 @@ ...@@ -37,14 +37,14 @@
* SDK退出引导 * SDK退出引导
--- ---
<a name="overview-changelog"></a> <a name="overview-changelog"></a>
### 2. 更新内容 ### 2. 更新内容
* *
--- ---
<a name="overview-prereq"></a> <a name="overview-prereq"></a>
### 3. 接入准备 ### 3. 接入准备
...@@ -72,38 +72,38 @@ ...@@ -72,38 +72,38 @@
```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 { maven {
url =uri("https://artifact.bytedance.com/repository/Volcengine/") url =uri("https://artifact.bytedance.com/repository/Volcengine/")
}
// 建议保留
google()
mavenCentral()
// 打华为包时保留
maven {
url = uri("https://developer.huawei.com/repo/")
}
} }
// 建议保留
google()
mavenCentral()
// 打华为包时保留
maven {
url = uri("https://developer.huawei.com/repo/")
}
}
} }
``` ```
>同时建议保留 **Google / Maven Central** 等,以便传递依赖解析。 >同时建议保留 **Google / Maven Central** 等,以便传递依赖解析。
> >
>若打 **华为** 包,则需加入华为maven库,以便下载华为插件。 >若打 **华为** 包,则需加入华为maven库,以便下载华为插件。
--- ---
...@@ -126,17 +126,17 @@ implementation("com.zw.game.center:gameCenter:1.0.0.0") ...@@ -126,17 +126,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")
} }
``` ```
...@@ -159,12 +159,12 @@ override fun getResources() = ZySdk.getResources(super.getResources()) ...@@ -159,12 +159,12 @@ override fun getResources() = ZySdk.getResources(super.getResources())
```java ```java
@Override @Override
public AssetManager getAssets() { public AssetManager getAssets() {
ZySdk.INSTANCE.getAssets(super.getAssets()); ZySdk.INSTANCE.getAssets(super.getAssets());
} }
@Override @Override
public Resources getResources() { public Resources getResources() {
ZySdk.INSTANCE.getResources(super.getResources()); ZySdk.INSTANCE.getResources(super.getResources());
} }
``` ```
...@@ -181,16 +181,17 @@ public Resources getResources() { ...@@ -181,16 +181,17 @@ public Resources getResources() {
```kotlin ```kotlin
ZySdk.sdkInit(activity) { result -> ZySdk.sdkInit(activity) { result ->
// 初始化结果:成功/失败信息与错误码等 // 初始化结果:成功/失败信息与错误码等
val obj = JSONObject(result) val obj = JSONObject(result)
val success = obj.optBoolean("success") val success = obj.optBoolean("success")
if (success) { if (success) {
Log.i(TAG, "init 成功") 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}")
}
} }
``` ```
...@@ -203,11 +204,13 @@ ZySdk.sdkInit(activity) { result -> ...@@ -203,11 +204,13 @@ ZySdk.sdkInit(activity) { result ->
**回参** **回参**
| 字段 | 类型 | 含义 | | 字段 | 类型 | 含义 |
|:-----------:|:-------:|:--------:| |:-------------:|:-------:|:------------------------------------:|
| `success` | Boolean | 是否成功 | | `success` | Boolean | 是否成功 |
| `errorMsg` | String | 失败时的提示文案 | | `errorMsg` | String | 失败时的提示文案 |
| `errorCode` | Int | 错误码 | | `errorCode` | Int | 错误码 |
| `msg` | String | 提示文案 |
| `channelCode` | String | 渠道编码(oppo、vivo、xiaomi、huawei、honor等) |
**华为渠道错误码如下:** **华为渠道错误码如下:**
...@@ -538,13 +541,13 @@ ZySdk.sdkUpdate(this) { result -> ...@@ -538,13 +541,13 @@ ZySdk.sdkUpdate(this) { result ->
显示浮窗 显示浮窗
```kotlin ```kotlin
ZySdk.sdkShowFloat(this) { result -> ZySdk.showHuaweiFloat(this) { result ->
} }
``` ```
隐藏浮窗 隐藏浮窗
```kotlin ```kotlin
ZySdk.sdkHideFloat(this) { result -> ZySdk.hideHuaweiFloat(this) { result ->
} }
``` ```
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论