> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Device Identifier Tracking

> Enable or disable Android ID and advertising identifier tracking in the MoEngage Android SDK.

## Android Id Tracking

From SDK version **11.5.00**, SDK optionally tracks Android-id for the devices(by default Android-id is not tracked). To enable Android-id tracking use the [enableAndroidIdTracking()](https://moengage.github.io/android-api-reference/core/com.moengage.core/enable-android-id-tracking.html) method as shown below.

<CodeGroup>
  ```Kotlin Kotlin wrap theme={null}
  import com.moengage.core.enableAndroidIdTracking
  enableAndroidIdTracking(context)
  ```

  ```Java Java theme={null}
  MoESdkStateHelper.enableAndroidIdTracking(context);
  ```
</CodeGroup>

Before enabling the Android-id tracking application should take consent from the user as per the [Google Policy](https://developer.android.com/identity/user-data-ids).Once tracking is enabled SDK would continue tracking the Android-id until explicitly opted-out. Use the [disableAndroidIdTracking()](https://moengage.github.io/android-api-reference/core/com.moengage.core/disable-android-id-tracking.html) method to opt-out of Android-id tracking.

<CodeGroup>
  ```Kotlin Kotlin wrap theme={null}
  import com.moengage.core.disableAndroidIdTracking
  disableAndroidIdTracking(context)
  ```

  ```Java Java theme={null}
  MoESdkStateHelper.disableAndroidIdTracking(context);
  ```
</CodeGroup>

For the SDK version below **11.5.00** use the *TrackingOptoutConfig* while initializing the MoEngage SDK.

## Advertising Identifier Tracking

From SDK version **12.1.00**, SDK optionally tracks Advertising Identifier for the devices(by default Advertising Identifier is not tracked). To enable Advertising Identifier tracking use the [enableAdIdTracking()](https://moengage.github.io/android-api-reference/core/com.moengage.core/enable-ad-id-tracking.html) method as shown below.

<CodeGroup>
  ```Kotlin Kotlin wrap theme={null}
  import com.moengage.core.enableAdIdTracking
  enableAdIdTracking(context)
  ```

  ```Java Java theme={null}
  MoESdkStateHelper.enableAdIdTracking(context);
  ```
</CodeGroup>

Before enabling the Advertising Identifier tracking application should take consent from the user as per the [Google Policy](https://support.google.com/googleplay/android-developer/answer/10144311).

Once tracking is enabled SDK would continue tracking the Advertising Identifier until explicitly opted-out. Use the [disableAdIdTracking()](https://moengage.github.io/android-api-reference/core/com.moengage.core/disable-ad-id-tracking.html) method to opt-out of Advertising Identifier tracking.

<CodeGroup>
  ```Kotlin Kotlin wrap theme={null}
  import com.moengage.core.disableAdIdTracking
  disableAdIdTracking(context)
  ```

  ```Java Java theme={null}
  MoESdkStateHelper.disableAdIdTracking(context);
  ```
</CodeGroup>

For the SDK version below **12.1.00** use the *TrackingOptoutConfig* while initializing the MoEngage SDK.
