• Developer Guide
  • Data Fetching Guide

Data Fetching Guide for Android

Airbridge Device ID

Device identifier by Airbridge. (UUID v4 format)

1234567891011121314
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;

Airbridge.getDeviceInfo().getUUID(new AirbridgeCallback.SimpleCallback<String>() {
    @Override
    public void onSuccess(String result) {
  
    }
  
    @Override
    public void onFailure(@NotNull Throwable throwable) {
  
    }
});

Airbridge Generated UUID

Random UUID assigned by Airbridge upon app install on each device. (UUID version 4 format)

12345
import co.ab180.airbridge.Airbridge;

Airbridge.fetchAirbridgeGeneratedUUID((uuid) -> {

});

App Set ID

Unique ID that publishers can use to identify which apps a specific user has installed. (UUID version 4 format)

12345678910111213141516171819
import android.content.Context;

import com.google.android.gms.appset.AppSet;
import com.google.android.gms.appset.AppSetIdClient;
import com.google.android.gms.appset.AppSetIdInfo;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;

Context context = getApplicationContext();
AppSetIdClient client = AppSet.getClient(context);
Task<AppSetIdInfo> task = client.getAppSetIdInfo();

task.addOnSuccessListener(new OnSuccessListener<AppSetIdInfo>() {
    @Override
    public void onSuccess(AppSetIdInfo info) {
        int appSetIdScope = info.getScope();
        String appSetId = info.getId();
    }
});

GAID (Google Advertising ID)

Advertising ID issued by Google. (UUID v4 format)

12345678910111213141516
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;
import co.ab180.airbridge.AdvertisingIdInfo;

Airbridge.getDeviceInfo().getGoogleAdvertisingIdInfo(new AirbridgeCallback.SimpleCallback<AdvertisingIdInfo>() {
    @Override
    public void onSuccess(AdvertisingIdInfo result) {
            result.getId(); // GAID
        result.getLimitAdTrackingEnabled(); // LAT
    }

    @Override
    public void onFailure(@NotNull Throwable throwable) {

    }
});

Google Limit AD Tracking

Device's Google Limit AD Tracking information.

12345678910111213141516
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;
import co.ab180.airbridge.AdvertisingIdInfo;

Airbridge.getDeviceInfo().getGoogleAdvertisingIdInfo(new AirbridgeCallback.SimpleCallback<AdvertisingIdInfo>() {
    @Override
    public void onSuccess(AdvertisingIdInfo result) {
            result.getId(); // GAID
        result.getLimitAdTrackingEnabled(); // LAT
    }

    @Override
    public void onFailure(@NotNull Throwable throwable) {

    }
});

Google Install Referrer

InstallReferrer information sent by Google Play Service.

123456789101112131415
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;
import co.ab180.airbridge.ReferrerDetails;

Airbridge.getDeviceInfo().getGoogleInstallReferrerDetails(new AirbridgeCallback.SimpleCallback<ReferrerDetails>() {
    @Override
    public void onSuccess(ReferrerDetails details) {
        
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
});

OAID (Huawei Advertising ID)

Advertising ID issued by Google. (UUID v4 format)

12345678910111213141516
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;
import co.ab180.airbridge.AdvertisingIdInfo;

Airbridge.getDeviceInfo().getHuaweiAdvertisingIdInfo(new AirbridgeCallback.SimpleCallback<AdvertisingIdInfo>() {
    @Override
    public void onSuccess(AdvertisingIdInfo result) {
            result.getId(); // OAID
        result.getLimitAdTrackingEnabled(); // LAT
    }

    @Override
    public void onFailure(@NotNull Throwable throwable) {

    }
});

Huawei Limit AD Tracking

Device's Huawei Limit AD Tracking information.

12345678910111213141516
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;
import co.ab180.airbridge.AdvertisingIdInfo;

Airbridge.getDeviceInfo().getHuaweiAdvertisingIdInfo(new AirbridgeCallback.SimpleCallback<AdvertisingIdInfo>() {
    @Override
    public void onSuccess(AdvertisingIdInfo result) {
            result.getId(); // OAID
        result.getLimitAdTrackingEnabled(); // LAT
    }

    @Override
    public void onFailure(@NotNull Throwable throwable) {

    }
});

Huawei Install Referrer

InstallReferrer information sent by Huawei Mobile Service.

123456789101112131415
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;
import co.ab180.airbridge.ReferrerDetails;

Airbridge.getDeviceInfo().getHuaweiInstallReferrerDetails(new AirbridgeCallback.SimpleCallback<ReferrerDetails>() {
    @Override
    public void onSuccess(ReferrerDetails details) {
        
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
});

One Store Install Referrer

InstallReferrer information sent by One Store.

123456789101112131415
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;
import co.ab180.airbridge.ReferrerDetails;

Airbridge.getDeviceInfo().getOneStoreInstallReferrerDetails(new AirbridgeCallback.SimpleCallback<ReferrerDetails>() {
    @Override
    public void onSuccess(ReferrerDetails details) {
        
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
});

Device Model

Device model name.

123
import android.os.Build;

Build.MODEL; // ex : Pixel 3a

Device Manufacturer

Device manufacturer information.

123
import android.os.Build;

Build.MANUFACTURER; // ex : Google

OS Version

Device OS version.

123
import android.os.Build;

Build.VERSION.RELEASE; // ex : 10

Locale

Device locale settings.

1234
import java.util.*;

// ex : en-US
String.format("%s-%s", Locale.getDefault().getLanguage(), Locale.getDefault().getCountry());

Timezone

Device timezone settings.

123
import java.util.*;

TimeZone.getDefault().getId(); // ex : Asia/Seoul

Orientation

Device display orientation. Values will be either "portrait" or "landscape"

123456789
import android.content.Context;
import android.content.res.Configuration;

String orientation;
if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
    orientation = "portrait";
} else {
    orientation = "landscape";
}

Screen Density

Device's screen density.

1234567891011121314151617181920212223242526
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import android.content.Context;

WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 
    DisplayMetrics realDisplayMetrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getRealMetrics(realDisplayMetrics);
    int width = realDisplayMetrics.widthPixels;
    int height = realDisplayMetrics.heightPixels;
    int dpi = realDisplayMetrics.densityDpi;
} else {
    DisplayMetrics displayMetrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getMetrics(displayMetrics);
    try {
        int width = (int) Display.class
                .getMethod("getRawWidth")
                .invoke(windowManager.getDefaultDisplay());
        int height = (int) Display.class
                .getMethod("getRawHeight")
                .invoke(windowManager.getDefaultDisplay());
        int dpi = displayMetrics.densityDpi;
   } catch (Exception e) { }
}

Screen Width

Device's actual width.

1234567891011121314151617181920212223242526
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import android.content.Context;

WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 
    DisplayMetrics realDisplayMetrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getRealMetrics(realDisplayMetrics);
    int width = realDisplayMetrics.widthPixels;
    int height = realDisplayMetrics.heightPixels;
    int dpi = realDisplayMetrics.densityDpi;
} else {
    DisplayMetrics displayMetrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getMetrics(displayMetrics);
    try {
        int width = (int) Display.class
                .getMethod("getRawWidth")
                .invoke(windowManager.getDefaultDisplay());
        int height = (int) Display.class
                .getMethod("getRawHeight")
                .invoke(windowManager.getDefaultDisplay());
        int dpi = displayMetrics.densityDpi;
   } catch (Exception e) { }
}

Screen Height

Device's actual height.

1234567891011121314151617181920212223242526
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import android.content.Context;

WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 
    DisplayMetrics realDisplayMetrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getRealMetrics(realDisplayMetrics);
    int width = realDisplayMetrics.widthPixels;
    int height = realDisplayMetrics.heightPixels;
    int dpi = realDisplayMetrics.densityDpi;
} else {
    DisplayMetrics displayMetrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getMetrics(displayMetrics);
    try {
        int width = (int) Display.class
                .getMethod("getRawWidth")
                .invoke(windowManager.getDefaultDisplay());
        int height = (int) Display.class
                .getMethod("getRawHeight")
                .invoke(windowManager.getDefaultDisplay());
        int dpi = displayMetrics.densityDpi;
   } catch (Exception e) { }
}

Longitude

Longitude of device's LastKnownLocation.

1234567891011121314151617181920212223242526
import android.location.Location;
import android.location.LocationManager;

LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Location gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Location netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
Location bestLocation = null;
        
if ((gpsLocation != null) && (netLocation != null)) {
    if (gpsLocation.getAccuracy() < netLocation.getAccuracy()) {
        bestLocation = gpsLocation;
    } else {
        bestLocation = netLocation;
    }
} else if (gpsLocation != null) {
    bestLocation = gpsLocation;
} else {
    bestLocation = netLocation;
}

if (bestLocation != null) {
    double latitude = bestLocation.getLatitude();
    double longitude = bestLocation.getLongitude();
    double altitude = bestLocation.getAltitude();
    float speed = bestLocation.getSpeed();
}

Latitude

Latitude of device's LastKnownLocation.

1234567891011121314151617181920212223242526
import android.location.Location;
import android.location.LocationManager;

LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Location gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Location netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
Location bestLocation = null;
        
if ((gpsLocation != null) && (netLocation != null)) {
    if (gpsLocation.getAccuracy() < netLocation.getAccuracy()) {
        bestLocation = gpsLocation;
    } else {
        bestLocation = netLocation;
    }
} else if (gpsLocation != null) {
    bestLocation = gpsLocation;
} else {
    bestLocation = netLocation;
}

if (bestLocation != null) {
    double latitude = bestLocation.getLatitude();
    double longitude = bestLocation.getLongitude();
    double altitude = bestLocation.getAltitude();
    float speed = bestLocation.getSpeed();
}

Altitude

Altitude of device's LastKnownLocation.

1234567891011121314151617181920212223242526
import android.location.Location;
import android.location.LocationManager;

LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Location gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Location netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
Location bestLocation = null;
        
if ((gpsLocation != null) && (netLocation != null)) {
    if (gpsLocation.getAccuracy() < netLocation.getAccuracy()) {
        bestLocation = gpsLocation;
    } else {
        bestLocation = netLocation;
    }
} else if (gpsLocation != null) {
    bestLocation = gpsLocation;
} else {
    bestLocation = netLocation;
}

if (bestLocation != null) {
    double latitude = bestLocation.getLatitude();
    double longitude = bestLocation.getLongitude();
    double altitude = bestLocation.getAltitude();
    float speed = bestLocation.getSpeed();
}

Speed

Speed of device's LastKnownLocation.

1234567891011121314151617181920212223242526
import android.location.Location;
import android.location.LocationManager;

LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Location gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Location netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
Location bestLocation = null;
        
if ((gpsLocation != null) && (netLocation != null)) {
    if (gpsLocation.getAccuracy() < netLocation.getAccuracy()) {
        bestLocation = gpsLocation;
    } else {
        bestLocation = netLocation;
    }
} else if (gpsLocation != null) {
    bestLocation = gpsLocation;
} else {
    bestLocation = netLocation;
}

if (bestLocation != null) {
    double latitude = bestLocation.getLatitude();
    double longitude = bestLocation.getLongitude();
    double altitude = bestLocation.getAltitude();
    float speed = bestLocation.getSpeed();
}

Network Carrier

Device network carrier information.

1234
import android.telephony.TelephonyManager;

TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String carrier = telephonyManager.getNetworkOperatorName();

Bluetooth Status

Device bluetooth status

1234
import android.bluetooth.BluetoothAdapter;

BluetoothAdapter bluetoothAdapter = (BluetoothAdapter) BluetoothAdapter.getDefaultAdapter();
val enabled = bluetoothAdapter.isEnabled();

Cellular Status

Device mobile data status.

123456789101112131415
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.content.Context;

ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    Network activeNetwork = connectivityManager.getActiveNetwork();
    NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(activeNetwork);
    boolean cellularEnabled = capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR);
} else {
    NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
    boolean cellularEnabled = (networkInfo.type == ConnectivityManager.TYPE_MOBILE);
}

Wifi Status

Device wifi status.

123456789101112131415
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.content.Context;

ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    Network activeNetwork = connectivityManager.getActiveNetwork();
    NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(activeNetwork);
    boolean wifiEnabled = capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
} else {
    NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
    boolean wifiEnabled = (networkInfo.type == ConnectivityManager.TYPE_WIFI);
}

Package Name

Application package name.

1234567891011
import android.content.pm.PackageManager;
import android.content.pm.PackageInfo;
import android.content.Context;

String packageName = "";
try {
    PackageInfo packageInfo = context.getPackageManager.getPackageInfo(context.packageName, 0)
    packageName = packageInfo.packageName;
} catch (PackageManager.NameNotFoundException e) {

}

Version

Application version name.

1234567891011
import android.content.pm.PackageManager;
import android.content.pm.PackageInfo;
import android.content.Context;

String packageName = "";
try {
    PackageInfo packageInfo = context.getPackageManager.getPackageInfo(context.packageName, 0);
    packageName = packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {

}

Event Timestamp

Timestamp(milliseconds) of when the event was sent.

1
System.currentTimeMillis();

Was this page helpful?

Have any questions or suggestions?