Developers of media apps, ad platforms, and third-party tracking platforms can integrate the SDK of HUAWEI Ads Kit to obtain OAID information from Huawei devices. The OAID information can be used to recommend personalized ads to users and attribute ad conversions.
Create a subthread and call the static AdvertisingIdClient.getAdvertisingIdInfo(mContext) method to obtain the OAID information. A sample code is as follows:
- /**
- * Obtain the OAID information in a non-UI thread.
- */
- private Thread getIdentifierThread = new Thread() {
- @Override
- public void run() {
- try {
- AdvertisingIdClient.Info info = AdvertisingIdClient.getAdvertisingIdInfo(mContext);
- if (null != info) {
- Log.i(TAG, "info id=" + info.getId() +
- ", isLimitAdTrackingEnabled=" + info.isLimitAdTrackingEnabled());
- }
- } catch (IOException e) {
- Log.i(TAG, "getAdvertisingIdInfo Exception: " + e.toString());
- }
- }
- };