The Open Anonymous Device Identifier (OAID) is a unique identifier for Android devices. The Mobile Security Alliance (MSA) recommends all Chinese-manufactured devices provide an OAID. You can use the OAID to attribute and measure devices where Google Play Services isn’t available.
The OAID plugin provides the OAID of a device. The SDK will continue to use other identifiers as well as the OAID.
Add the plugin to your app
The Adjust OAID plugin for React Native is available from npm.
$ npm install react-native-adjust-oaid --saveAdd the MSA SDK to your app
Requirements
To enable the OAID plugin to read OAID values from the MSA SDK, you need to add it to your project. To do this:
- Copy the MSA SDK (AAR file) to the
libsdirectory of your project and set the dependency. - Copy the
supplierconfig.jsonfile to theassetsdirectory of your project. - You can find the MSA SDK and detailed instructions at the MSA website.
Add the HMS Core SDK to your app
You can use the HMS Core SDK to access the OAID of Huawei devices. To enable the Adjust OAID plugin to read values from the HMS Core SDK, update your build.gradle as follows:
- Add the Huawei maven repository.
repositories { maven { url "https://developer.huawei.com/repo/" }}- Add the HMS Core SDK.
dependencies { implementation 'com.huawei.hms:ads-identifier:3.4.56.300'}Use the plugin
Once you have set up the plugin, you can gather the device’s OAID. To do this, call the AdjustOaid.ReadOaid method before starting the Adjust SDK.
import { AdjustOaid } from "react-native-adjust-oaid";AdjustOaid.readOaid();// ...Adjust.initSdk(adjustConfig);To stop the SDK from reading OAID values, call the AdjustOaid.doNotReadOaid() method.
import { AdjustOaid } from "react-native-adjust-oaid";AdjustOaid.doNotReadOaid();// ...Adjust.initSdk(adjustConfig);