Skip to content

OAID SDK集成说明
OAID SDK Integration Instructions

1. Android 10 OAID 描述
Android 10 OAID description

Android 10 无法通过常规方式获取IMEI等设备ID,影响部分广告网络(Sigmob、快手等)正常广告加载、展示等业务,开发者需要接入 OAID SDK 才可以正常加载这些广告网络的广告。建议开发者优先集成OAID,集成方式可以参看demo MSA联盟官网地址: http://www.msa-alliance.cn/col.jsp?id=120

Android 10 cannot obtain device IDs such as IMEI through conventional methods, which affects the normal ad loading and display of some ad networks (Sigmob, Kuaishou, etc.). Developers need to access the OAID SDK to load ads from these ad networks normally. It is recommended that developers integrate OAID first. For integration methods, please refer to the demo MSA Alliance official website address: http://www.msa-alliance.cn/col.jsp?id=120

OAID SDK 不是 ToBid 必要组件。此章节所提及的内容,开发者根据自身情况判断是否处理。满足以下场景下可不处理 1. 应用已接入 OAID ; 2.应用不使用快手等依赖 OAID 的广告网络。

OAID SDK is not a necessary component of ToBid. Developers can decide whether to handle the content mentioned in this chapter based on their own situation. It is not necessary to handle it in the following scenarios: 1. The application has been connected to OAID; 2. The application does not use advertising networks such as Kuaishou that rely on OAID.

2. 引入依赖
Introducing dependencies

  • 把 msa_mdid_x.x.x.aar 或者 oaid_sdk_x.x.x.aar 拷贝到项的 libs 目录,并设置依赖,其中 x.x.x 代表版本号。
    Copy msa_mdid_x.xxaar or oaid_sdk_x.xxaar to the libs directory of the project and set the dependency, where xxx represents the version number.
implementation files('libs/msa_mdid_x.x.x.aar')
或者
implementation files('libs/oaid_sdk_x.x.x.aar')

3. Assets设置
Assets settings

  • 将 supplierconfig.json 拷贝到项目 assets 目录下,并修改里边对应内容,特别是需要设置 appid 的部分。需要设置 appid 的部分需要去对应厂商的应用商店里注册自己的app。
    Copy supplierconfig.json to the project assets directory and modify the corresponding content, especially the part where you need to set the appid. For the part where you need to set the appid, you need to register your app in the corresponding manufacturer's app store.
  • 将证书文件(应用包名.cert.pem)拷贝到项目 app/src/main/assets 目录下或在SDK初始化前通过 WindAds.setOAIDCertPem(certpemStr) 传入OAID证书Pem内容。
    Copy the certificate file ( app package name.cert.pem ) to the project app/src/main/assets directory or pass the OAID certificate Pem content through WindAds.setOAIDCertPem(certpemStr) before initializing the SDK
  • 仅1.0.26+版本需要配置证书
    Only versions 1.0.26 and above require certificate configuration .

证书需要填写 example_batch.csv 后发送到 msa@caict.ac.cn 申请,注意每个包名对应一个签名,申请时需要将所需申请的全部包名填写到表格中。为避免证书过期影响 APP 获取 ID,建议证书信息可以从后台服务器获取,或 者当调用 oaid SDK 接口提示证书无效时,调用后台接口及时更新证书信息,并且 快到期时及时提前重新申请证书。

The certificate needs to be filled in example_batch.csv and sent to msa@caict.ac.cn for application. Note that each package name corresponds to a signature. When applying, all the package names required need to be filled in the form. To avoid the impact of certificate expiration on APP ID acquisition, it is recommended that the certificate information can be obtained from the background server, or when the oaid SDK interface is called and the certificate is prompted to be invalid, the background interface is called to update the certificate information in time, and the certificate is re-applied in advance when it is about to expire.

4. gradle 配置
gradle configuration

  • 设置 gradle 编译选项,这里可以根据自己对平台的选择进行合理配置。
    Set the gradle compilation options. You can configure them reasonably according to your choice of platform.
ndk {
  abiFilters 'armeabi-v7a','x86','arm64-v8a','x86_64','armeabi'
}

packagingOptions {
    doNotStrip "*/armeabi-v7a/*.so"
    doNotStrip "*/x86/*.so"
    doNotStrip "*/arm64-v8a/*.so"
    doNotStrip "*/x86_64/*.so"
    doNotStrip "armeabi.so"
}

5. 混淆设置
Obfuscation settings

  • 现SDK支持oaid_sdk_1.0.10、1.0.13、1.0.22、1.0.23、1.0.25, 1.0.30, 1.1.0, 1.2.0, 1.2.1 等版本、但是媒体必须按照以下混淆配置进行设置
    The SDK currently supports oaid_sdk_1.0.10, 1.0.13, 1.0.22, 1.0.23, 1.0.25, 1.0.30, 1.1.0, 1.2.0, 1.2.1, etc. However, the media must be set according to the following obfuscation configuration
java
# 1.0.25之后

# sdk
-keep class com.bun.miitmdid.** { *; }
-keep interface com.bun.supplier.** { *; }

# asus
-keep class com.asus.msa.SupplementaryDID.** { *; }
-keep class com.asus.msa.sdid.** { *; }
# freeme
-keep class com.android.creator.** { *; }
-keep class com.android.msasdk.** { *; }
# huawei
-keep class com.huawei.hms.ads.** { *; }
-keep interface com.huawei.hms.ads.** {*; }
# lenovo
-keep class com.zui.deviceidservice.** { *; }
-keep class com.zui.opendeviceidlibrary.** { *; }
# meizu
-keep class com.meizu.flyme.openidsdk.** { *; }
# nubia
-keep class com.bun.miitmdid.provider.nubia.NubiaIdentityImpl { *; }
# oppo
-keep class com.heytap.openid.** { *; }
# samsung
-keep class com.samsung.android.deviceidservice.** { *; }
# vivo
-keep class com.vivo.identifier.** { *; }
# xiaomi
-keep class com.bun.miitmdid.provider.xiaomi.IdentifierManager { *; }
# zte
-keep class com.bun.lib.** { *; }
# coolpad
-keep class com.coolpad.deviceidsupport.** { *; }

# 1.0.25 之前
-dontwarn com.bun.**
-keep class com.bun.** {*;}
-keep class a.**{*;}
-keep class XI.CA.XI.**{*;}
-keep class XI.K0.XI.**{*;}
-keep class XI.XI.K0.**{*;}
-keep class XI.vs.K0.**{*;}
-keep class XI.xo.XI.XI.**{*;}
-keep class com.asus.msa.SupplementaryDID.**{*;}
-keep class com.asus.msa.sdid.**{*;}
-keep class com.huawei.hms.ads.identifier.**{*;}
-keep class com.samsung.android.deviceidservice.**{*;}
-keep class com.zui.opendeviceidlibrary.**{*;}
-keep class org.json.**{*;}
-keep public class com.netease.nis.sdkwrapper.Utils {public <methods>;}

6.错误码
Error Code

信息码(引用 InfoCode 类) Information code (reference InfoCode class)

信息
information

value
说明
illustrate
INIT_INFO_RESULT_OK1008610调用成功,获取接口是同步的
The call is successful, and the interface acquisition is synchronous
INIT_INFO_RESULT_DELAY1008614调用成功,获取接口是异步的
The call is successful, and the interface acquisition is asynchronous
INIT_ERROR_CERT_ERROR1008616证书未初始化或证书无效
The certificate is not initialized or is invalid.
INIT_ERROR_MANUFACTURER_NOSUPPORT1008611不支持的厂商
Unsupported manufacturers
INIT_ERROR_DEVICE_NOSUPPORT1008612不支持的设备
Unsupported devices
INIT_ERROR_LOAD_CONFIGFILE1008613加载配置文件出错
Error loading configuration file
INIT_ERROR_SDK_CALL_ERROR1008615sdk调用出错
SDK call error

7.如何检验oaid接入成功
How to verify that oaid access is successful

两种方法查看oaid是否接入成功:
There are two ways to check whether oaid is successfully connected:

  • 提供一下应用id,包名,及应用版本号,我们这边查一下后台日志即可;
    Provide the application ID, package name, and application version number, and we can check the background log;
  • Android Studio 控制台里使用logcat 过滤一下MdidSdkHelper 关键字。
    In the Android Studio console, use logcat to filter the MdidSdkHelper keyword.