浏览代码

add Configuring Obfuscation Scripts in docs

/unity2020
mk 3 年前
当前提交
498ba65c
共有 12 个文件被更改,包括 203 次插入7 次删除
  1. 11
      Documentation/analyticskit.md
  2. 12
      Documentation/apm.md
  3. 3
      Documentation/auth.md
  4. 11
      Documentation/cn/Documentation/analyticskit.md
  5. 11
      Documentation/cn/Documentation/apm.md
  6. 3
      Documentation/cn/Documentation/auth.md
  7. 27
      Documentation/cn/Documentation/gameservices.md
  8. 27
      Documentation/cn/Documentation/locationkit.md
  9. 24
      Documentation/cn/Documentation/pushkit.md
  10. 29
      Documentation/gameservices.md
  11. 28
      Documentation/locationkit.md
  12. 24
      Documentation/pushkit.md

11
Documentation/analyticskit.md


![Images/hms/AgcConnectServicesJson.png](Images/hms/AgcConnectServicesJson.png)
9. Get activity
9. Configuring Obfuscation Scripts ([Reference](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-appendix-d-0000001050167398))
(Optional) Configure the keep.xml file as follows to keep layout resources if you have enabled R8 resource shrinking (with shrinkResources being set to true in the project-level build.gradle file) and strict reference checks (with shrinkMode being set to strict in the res/raw/keep.xml file). Not keeping layout resources will lead to app rejection during release to HUAWEI AppGallery.
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*"
tools:shrinkMode="strict" />
```
10. Get activity
For getting the activity, you can use the `Common.GetActivity()` function.

12
Documentation/apm.md


}
```
* Add the following items to the proguard file in your Unity project for obfuscation configurations([Reference](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-apm-android-getstarted-0000001052887262)):
```
-keep class com.huawei.agconnect.**{*;}
-dontwarn com.huawei.agconnect.**
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
-keepattributes Exceptions, Signature, InnerClasses, LineNumberTable
```
### Step 3: Integrating the APM Plug-in
The APM plug-in uses the instrumentation technology to collect [HTTP/HTTPS network request performance data](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-apms-appnetwork) without intrusion. To add the APM plug-in to your app, perform the following steps:
1. Add the APM plug-in to the `launcherTemplate.gradle` file

3
Documentation/auth.md


```
- **Facebook**
**Important Note:** Facebook updated the webview policy
* Facebook Login will no longer support Android embedded browsers (WebViews) for authenticating users. Please refer to the following documents for configuration!
* https://developers.facebook.com/docs/facebook-login/android/deprecating-webviews
1) Refer to the [Facebook Doc](https://developers.facebook.com/docs/facebook-login/android), Configure build dependencies in `MainTemplate.gradle`.

11
Documentation/cn/Documentation/analyticskit.md


![Images/hms/AgcConnectServicesJson.png](Images/hms/AgcConnectServicesJson.png)
9. 获取activity
9. 配置混淆脚本 ([参考](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-appendix-d-0000001050167398))
- (可选)当您启用R8资源缩减(项目级“build.gradle”文件中“shrinkResources”属性为“true”)和严格引用检查(“res/raw/keep.xml”文件中的“shrinkMode”为“strict”)时,请您配置“keep.xml”文件手动保留layout资源,确保应用正常通过华为应用市场上架审核。
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*"
tools:shrinkMode="strict" />
```
10. 获取activity
可以用 `Common.GetActivity()`函数来获取activity。

11
Documentation/cn/Documentation/apm.md


```
* 在您的Unity项目里打开混淆配置文件,添加以下排除项([参考华为文档](https://developer.huawei.com/consumer/cn/doc/development/AppGallery-connect-Guides/agc-apm-android-getstarted-0000001052887262)):
```
-keep class com.huawei.agconnect.**{*;}
-dontwarn com.huawei.agconnect.**
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
-keepattributes Exceptions, Signature, InnerClasses, LineNumberTable
```
### 3. 集成APM插件

3
Documentation/cn/Documentation/auth.md


```
#### Facebook
**重要更新:** Facebook 更新了 webview 登录政策
* Facebook 登录将不再支持用于验证用户身份的 Android 嵌入式浏览器 (WebViews)。 配置调整请参考以下文档!
* https://developers.facebook.com/docs/facebook-login/android/deprecating-webviews
1. 使用Facebook帐户登录,使用LoginManager.getInstance().startFacebook(string APP_ID,OnSuccessListener successCallback,OnFailureListener failCallback)获取访问令牌Json

27
Documentation/cn/Documentation/gameservices.md


**DEPS**}
```
5. 配置混淆脚本
您编译APK前需要配置混淆配置文件,避免混淆HMS Core SDK导致功能异常。
- 在您的Unity项目里打开混淆配置文件,加入排除HMS Core SDK的混淆配置。
```
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
-keep class com.huawei.hms.analytics.HiAnalyticsInstance{*;}
-keep class com.huawei.hms.analytics.HiAnalytics{*;}
```
- (可选)当您启用R8资源缩减(项目级“build.gradle”文件中“shrinkResources”属性为“true”)和严格引用检查(“res/raw/keep.xml”文件中的“shrinkMode”为“strict”)时,请您配置“keep.xml”文件手动保留layout资源,确保应用正常通过华为应用市场上架审核。
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*,@drawable/c_buoycircle*,@drawable/hms_game*,@layout/c_buoycircle*,@layout/hms_game*,@strings/hms_game*,@strings/c_buoycircle*"
tools:shrinkMode="strict" />
```
### 3. Huawei API 参考链接 与 集成开发流程
#### 3.1 Huawei API reference

27
Documentation/cn/Documentation/locationkit.md


![Images/hms/AgcConnectServicesJson.png](Images/hms/AgcConnectServicesJson.png)
9. 获取activity
9. 配置混淆脚本
编译APK前需要配置混淆配置文件,避免混淆HMS Core SDK导致功能异常。([参考文档](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/config-obfuscation-scripts-0000001188775555))
- 在您的Unity项目里打开混淆配置文件,加入排除HMS Core SDK的混淆配置。
```
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class * extends com.huawei.hms.core.aidl.IMessageEntity{ *; }
-keep public class com.huawei.location.nlp.network.** {*; }
-keep class com.huawei.wisesecurity.ucs.**{*;}
```
- (可选)当您启用R8资源缩减(项目级“build.gradle”文件中shrinkResources属性为“true”)和严格引用检查(“res/raw/keep.xml”文件中的shrinkMode为“strict”)时,请您配置“keep.xml”文件手动保留layout资源,确保应用正常通过华为应用市场上架审核。
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*"
tools:shrinkMode="strict" />
```
10. 获取activity
可以用 `Common.GetActivity()`函数来获取activity。

24
Documentation/cn/Documentation/pushkit.md


![Images/hms/AgcConnectServicesJson.png](Images/hms/AgcConnectServicesJson.png)
9. 获取activity
9. 配置混淆脚本
编译APK前需要配置混淆配置文件,避免混淆HMS Core SDK导致功能异常。([参考文档](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-config-obfuscation-scripts-0000001050176973))
- 在您的Unity项目里打开混淆配置文件,加入排除HMS Core SDK的混淆配置。
```
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
```
- (可选)当您启用R8资源缩减(项目级“build.gradle”文件中“shrinkResources”属性为“true”)和严格引用检查(“res/raw/keep.xml”文件中的“shrinkMode”为“strict”)时,请您配置“keep.xml”文件手动保留layout资源,确保应用正常通过华为应用市场上架审核。
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*"
tools:shrinkMode="strict" />
```
10. 获取activity
可以用 `Common.GetActivity()`函数来获取activity。

29
Documentation/gameservices.md


**DEPS**}
```
5. Configuring Obfuscation Scripts
Before building the APK, configure the obfuscation configuration file to prevent the HMS Core SDK from being obfuscated.
- Open the proguard file in your Unity project and add configurations to exclude the HMS Core SDK from obfuscation.
```
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
-keep class com.huawei.hms.analytics.HiAnalyticsInstance{*;}
-keep class com.huawei.hms.analytics.HiAnalytics{*;}
```
- (Optional) Configure the keep.xml file as follows to keep layout resources if you have enabled R8 resource shrinking (with shrinkResources being set to true in the project-level build.gradle file) and strict reference checks (with shrinkMode being set to strict in the res/raw/keep.xml file). Not keeping layout resources will lead to app rejection during release to HUAWEI AppGallery.
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*,@drawable/c_buoycircle*,@drawable/hms_game*,@layout/c_buoycircle*,@layout/hms_game*,@strings/hms_game*,@strings/c_buoycircle*"
tools:shrinkMode="strict" />
```
### 3. Huawei API reference link & integration guide
#### 3.1 Huawei API reference

- New: Add `CheckUpdate` , `ShowUpdateDialog`, `ReleaseCallBack` to check if there is a later version.
- New: Add `CancelAuthorization` to revoke authorization on your app.
- New: Add `StartReadSms`, `RegisterSMSBroadcastReceiver`, `UnregisterSMSBroadcastReceiver` to automatically read an SMS verification code.

28
Documentation/locationkit.md


![Images/hms/AgcConnectServicesJson.png](Images/hms/AgcConnectServicesJson.png)
9. Get activity
9. Configuring Obfuscation Scripts
Before building the APK, configure the obfuscation configuration file to prevent the HMS Core SDK from being obfuscated.([Reference](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/config-obfuscation-scripts-0000001188775555))
- Open the proguard file in your Unity project and add configurations to exclude the HMS Core SDK from obfuscation.
```
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class * extends com.huawei.location.router.LocationApiRequest{ *; }
-keep class * extends com.huawei.hms.core.aidl.IMessageEntity{ *; }
-keep public class com.huawei.location.nlp.network.** {*; }
-keep class com.huawei.wisesecurity.ucs.**{*;}
```
- (Optional) Configure the keep.xml file as follows to keep layout resources if you have enabled R8 resource shrinking (with shrinkResources being set to true in the project-level build.gradle file) and strict reference checks (with shrinkMode being set to strict in the res/raw/keep.xml file). Not keeping layout resources will lead to app rejection during release to HUAWEI AppGallery.
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off"
tools:shrinkMode="strict" />
```
10. Get activity
For getting the activity, you can use the `Common.GetActivity()` function.

24
Documentation/pushkit.md


![Images/hms/AgcConnectServicesJson.png](Images/hms/AgcConnectServicesJson.png)
9. Get activity
9. Configuring Obfuscation Scripts
Before building the APK, configure the obfuscation configuration file to prevent the HMS Core SDK from being obfuscated.([Reference](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-config-obfuscation-scripts-0000001050176973))
- Open the proguard file in your Unity project and add configurations to exclude the HMS Core SDK from obfuscation.
```
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
```
- (Optional) Configure the keep.xml file as follows to keep layout resources if you have enabled R8 resource shrinking (with shrinkResources being set to true in the project-level build.gradle file) and strict reference checks (with shrinkMode being set to strict in the res/raw/keep.xml file). Not keeping layout resources will lead to app rejection during release to HUAWEI AppGallery.
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/hms_download_progress,@drawable/screen_off,@layout/upsdk*"
tools:shrinkMode="strict" />
```
10. Get activity
For getting the activity, you can use the `Common.GetActivity()` function.

正在加载...
取消
保存