OAID
Overview
Collect the Android Open Anonymous Device Identifier (OAID) to attribute installs from third-party Android app stores.
The OAID is a user-resettable unique identifier for Android devices. It was introduced by the Mobile Security Alliance (MSA), China Information and Communication Research Institute, and device manufacturers, as a privacy-preserving alternative to non-resettable device identifiers like IMEI.
Integration
Requires AppsFlyer SDK V5.4.0+
OAID integration consists of 3 steps:
- Integrating the AppsFlyer SDK in the
build.gradle
file of your project - Integrating the AppsFlyer OAID plugin module in the
build.gradle
file of your project
dependencies {
implementation 'com.appsflyer:af-android-sdk:6.9.4'
implementation 'com.appsflyer:oaid:6.9.0'
}
- Integrating an SDK to generate and provide the OAID (either the MSA SDK or Huawei HMS SDK)
- Add the ProGuard rules to protect the necessary classes and interfaces from the MSA and various device manufacturers.
Note:
- For apps that are intended to be used in China, the MSA SDK must be used.
- For apps that are intended to be used globally on Huawei devices, the Huawei HMS library should be used.
MSA SDK integration
To integrate the MSA SDK:
- Get from the marketer: The MSA SDK (aar) file and the certificate that needs to be integrated into the app.
- Copy the MSA SDK (aar) under the libs folder.
- Copy and paste
supplierconfig.json
under the assets folder of the project and make the necessary changes, such as updating the appid of your app in each of the stores. - Copy and paste the certificate file (bundle name.cert.pem) under the assets folder of the project.
- See full instructions on the MSA website
- Update the
build.gradle
file of your project as follows:
implementation 'com.appsflyer:af-android-sdk:6.9.4'
implementation 'com.appsflyer:oaid:6.9.0'
implementation files('libs/oaid_sdk_2.0.0.aar')
Huawei HMS SDK integration
To integrate the Hauwei HMS SDK:
- Add the Huawei maven repo as follows:
repositories {
maven {
url "https://developer.huawei.com/repo/"
}
}
- Update the
build.gradle
file of your app as follows:
dependencies {
implementation 'com.appsflyer:af-android-sdk:6.9.4'
implementation 'com.appsflyer:oaid:6.9.0'
implementation 'com.huawei.hms:ads-identifier:3.4.56.300'
}
ProGuard rules update (when using ProGuard)
Protect the necessary classes and interfaces from MSA and various device manufacturers.
Add the following code to your proguard-rules.pro
file:
# 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.** { *; }
Additional information
Opting out of OAID collection
To opt-out of OAID collection, use one of the following APIs:
- setCollectOAID as follows:
AppsFlyerlib.setCollectOaid(false);
- setDisableAdvertisingIdentifiers as follows:
AppsFlyerlib.setDisableAdvertisingIdentifiers(true);
Setting OAID manually
To manually set the OAID into the AppsFlyer SDK:
- Use the setOaidData API as follows:
AppsFlyerlib.setOaidData(oaid);
Updated 28 days ago