Gather device IDs

Some analytics services need you to coordinate device and client IDs. This is necessary to prevent duplicate reporting.

Google Play Services Advertising Identifier

The Google Play Services Advertising Identifier (Google advertising ID) is a unique identifier for a device. Users can opt out of sharing their Google advertising ID by toggling the "Opt out of Ads Personalization" setting on their device. When a user has enabled this setting, the Adjust SDK returns a string of zeros when trying to read the Google advertising ID.

Important:
If you are targeting Android 12 and above (API level 31), you need to add the com.google.android.gms.AD_ID permission to your app. If you do not add this permission, you will not be able to read the Google advertising ID even if the user has not opted out of sharing their ID.
Java
Javascript

You can only read the Google Advertising ID in a background thread. Call the getGoogleAdId function with the context and an OnDeviceIdsRead instance. This should work in any situation.

Adjust.getGoogleAdId(this, new OnDeviceIdsRead() {
    @Override
    public void onGoogleAdIdRead(String googleAdId) {}
});

Amazon advertising identifier

Call the Adjust.getAmazonAdId method to get the device's Amazon Advertising ID.

Java
Javascript
String amazonAdId = Adjust.getAmazonAdId(context);

Adjust device identifier

When the backend tracks a device, it generates an Adjust Device ID (ADID) for it. To get the device's ADID, call the Adjust.getAdid method.

Note:
The ADID is only available after the Adjust backend has tracked an install. It is not possible to access the ADID before you initialize the Adjust SDK. Once the Adjust SDK has sent the install information to the Adjust backend, you will be able to access the ADID.
Java
Javascript
String adid = Adjust.getAdid();