Android Data Spec

Android Data Spec

Airbridge Device IDlink


Airbridge의 기기 식별자 입니다. UUID 버전4 포멧의 형태로 전달됩니다.

import io.airbridge.deviceinfo.DeviceInfo;
DeviceInfo.getInstance().getUUID(); // ex : 82a16ec9-a273-48b6-9bb2-017eab641109

GAID (Google Advertising ID)link


기기의 GAID를 획득하는 방법은 [구글 사이트](https://developer.android.com/training/articles/ad-id)에서 확인 하실 수 있습니다.

Limit AD Trackinglink


기기의 Limit AD Tracking 정보를 얻기 위해서는 [GAID](#gaid) 획득과 같은 AdvertisingIdInfo 클래스 객체에서 확인하실 수 있습니다.

Device Modellink


기기의 모델 이름 입니다.

import android.os.Build;
Build.MODEL; // ex : Pixel 3a

Device Manufacturerlink


기기의 제조사 정보 입니다.

import android.os.Build;
Build.MANUFACTURER; // ex : Google

OS Namelink


안드로이드의 경우, "Android" 입니다.

OS Versionlink


기기의 OS 버전입니다.

import android.os.Build;
Build.VERSION.RELEASE; // ex : 10

Localelink


기기의 locale 설정 값 입니다.

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

Timezonelink


기기의 Timezone 설정 값 입니다.

import java.util.*;
TimeZone.getDefault().getId(); // ex : Asia/Seoul

Orientationlink


기기의 화면 방향 값 입니다. "portrait" 혹은 "landscape" 둘 중 하나의 값 입니다.

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 Densitylink


기기의 실제 화면 Density 값 입니다.

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 Heightlink


기기의 실제 화면 Height 값 입니다.

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 Widthlink


기기의 실제 화면 Width 값 입니다.

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) { }
}

Longitudelink


현재 기기의 LastKnownLocation의 Longitude 값 입니다.

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();
}

Latitudelink


현재 기기의 LastKnownLocation의 Latitude 값 입니다.

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();
}

Altitudelink


현재 기기의 LastKnownLocation의 Altitude 값 입니다.

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();
}

Speedlink


현재 기기의 LastKnownLocation의 Speed 값 입니다.

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 Carrierlink


해당 기기의 네트워크 사업자 정보 입니다.

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

Bluetooth Statuslink


해당 기기의 블루투스 사용 여부 입니다.

import android.bluetooth.BluetoothAdapter;
BluetoothAdapter bluetoothAdapter = (BluetoothAdapter) BluetoothAdapter.getDefaultAdapter();
val enabled = bluetoothAdapter.isEnabled();

Cellular Statuslink


해당 기기의 모바일 데이터 사용 여부 입니다.

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 Statuslink


해당 기기의 Wifi 데이 사용 여부 입니다.

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 Namelink


해당 어플리케이션의 패키지 명 입니다.

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) {
}

Versionlink


해당 어플리케이션의 버전 이름 입니다.

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 Timestamplink


해당 이벤트의 발송 시간(Milliseconds) 입니다.

System.currentTimeMillis();