Data Fetching Guide for Android SDK

Airbridge Device ID

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

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) {
  
    }
});
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback

Airbridge.getDeviceInfo().getUUID(object : AirbridgeCallback.SimpleCallback<String>() {
        override fun onSuccess(result: String) {
  
    }

    override fun onFailure(throwable: Throwable) {
  
    }
})

GAID (Google Advertising ID)

구글에서 발급하는 Advertising ID 입니다. UUID 버전4 포멧의 형태로 전달됩니다.

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

    }
});
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback
import co.ab180.airbridge.AdvertisingIdInfo

Airbridge.getDeviceInfo().getAdvertisingIdInfo(object : AirbridgeCallback.SimpleCallback<AdvertisingIdInfo>() {
        override fun onSuccess(result: AdvertisingIdInfo) {
            result.getId() // GAID
        result.getLimitAdTrackingEnabled() // LAT
    }

    override fun onFailure(throwable: Throwable) {
  
    }
})

Google Limit AD Tracking

기기의 Google Limit AD Tracking 정보 입니다.

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

    }
});
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback
import co.ab180.airbridge.AdvertisingIdInfo

Airbridge.getDeviceInfo().getAdvertisingIdInfo(object : AirbridgeCallback.SimpleCallback<AdvertisingIdInfo>() {
        override fun onSuccess(result: AdvertisingIdInfo) {
            result.getId() // GAID
        result.getLimitAdTrackingEnabled() // LAT
    }

    override fun onFailure(throwable: Throwable) {
  
    }
})

Google Install Referrer

Google Play Service에서 전달되어지는 Install Referrer 정보입니다.

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

    }
});
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback
import co.ab180.airbridge.ReferrerDetails
  
Airbridge.getDeviceInfo().getGoogleInstallReferrerDetails(object : AirbridgeCallback<ReferrerDetails?> {
  override fun onSuccess(result: ReferrerDetails?) {
  
  }
  
  override fun onFailure(throwable: Throwable) {

  }
  
  override fun onComplete() {
  
  }
})

OAID (Huawei Advertising ID)

화웨이에서 발급하는 Advertising ID 입니다. UUID 버전4 포멧의 형태로 전달됩니다.

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

    }
});
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback
import co.ab180.airbridge.AdvertisingIdInfo

Airbridge.getDeviceInfo().getHuaweiAdvertisingIdInfo(object : AirbridgeCallback.SimpleCallback<AdvertisingIdInfo>() {
        override fun onSuccess(result: AdvertisingIdInfo) {
            result.getId() // OAID
        result.getLimitAdTrackingEnabled() // LAT
    }

    override fun onFailure(throwable: Throwable) {
  
    }
})

Huawei Limit AD Tracking

기기의 Huawei Limit AD Tracking 정보 입니다.

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

    }
});
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback
import co.ab180.airbridge.AdvertisingIdInfo

Airbridge.getDeviceInfo().getHuaweiAdvertisingIdInfo(object : AirbridgeCallback.SimpleCallback<AdvertisingIdInfo>() {
        override fun onSuccess(result: AdvertisingIdInfo) {
            result.getId() // OAID
        result.getLimitAdTrackingEnabled() // LAT
    }

    override fun onFailure(throwable: Throwable) {
  
    }
})

Huawei Install Referrer

Huawei Mobile Service(HMS Core) 에서 전달되어지는 Install Referrer 정보입니다.

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

    }
});
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback
import co.ab180.airbridge.ReferrerDetails
  
Airbridge.getDeviceInfo().getHuaweiInstallReferrerDetails(object : AirbridgeCallback<ReferrerDetails?> {
  override fun onSuccess(result: ReferrerDetails?) {
  
  }
  
  override fun onFailure(throwable: Throwable) {

  }
  
  override fun onComplete() {
  
  }
})

One Store Install Referrer

One Store 에서 전달되어지는 Install Referrer 정보입니다.

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

    }
});
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback
import co.ab180.airbridge.ReferrerDetails
  
Airbridge.getDeviceInfo().getOneStoreInstallReferrerDetails(object : AirbridgeCallback<ReferrerDetails?> {
  override fun onSuccess(result: ReferrerDetails?) {
  
  }
  
  override fun onFailure(throwable: Throwable) {

  }
  
  override fun onComplete() {
  
  }
})

Device Model

기기의 모델 이름 입니다.

import android.os.Build;

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

Build.MODEL // ex : Pixel 3a

Device Manufacturer

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

import android.os.Build;

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

Build.MANUFACTURER // ex : Google

OS Version

기기의 OS 버전입니다.

import android.os.Build;

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

Build.VERSION.RELEASE // ex : 10

Locale

기기의 Locale 설정 값 입니다.

import java.util.*;

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

// ex : en-US
"${Locale.getDefault().language}-${Locale.getDefault().country}"

Timezone

기기의 Timezone 설정 값 입니다.

import java.util.*;

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

TimeZone.getDefault().id // ex : Asia/Seoul

Orientation

기기의 화면 방향 값 입니다. "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";
}
import android.content.res.Configuration
import android.content.Context

var orientation: String
if (context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
    orientation = "portrait"
} else {
    orientation = "landscape"
}

Screen Density

기기의 실제 화면 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) { }
}
import android.util.DisplayMetrics
import android.view.Display
import android.view.WindowManager
import android.content.Context

val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    val realDisplayMetrics = DisplayMetrics()
    windowManager.defaultDisplay.getRealMetrics(realDisplayMetrics)
    val width = realDisplayMetrics.widthPixels
    val height = realDisplayMetrics.heightPixels
    val dpi = realDisplayMetrics.densityDpi
} else {
    val displayMetrics = DisplayMetrics()
    windowManager.defaultDisplay.getMetrics(displayMetrics)
    try {
        val width = Display::class.java
                .getMethod("getRawWidth")
                .invoke(windowManager.defaultDisplay) as Int
        val height = Display::class.java
                .getMethod("getRawHeight")
                .invoke(windowManager.defaultDisplay) as Int
        val dpi = displayMetrics.densityDpi
    } catch (_: Exception) { }
}

Screen 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) { }
}
import android.util.DisplayMetrics
import android.view.Display
import android.view.WindowManager
import android.content.Context

val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    val realDisplayMetrics = DisplayMetrics()
    windowManager.defaultDisplay.getRealMetrics(realDisplayMetrics)
    val width = realDisplayMetrics.widthPixels
    val height = realDisplayMetrics.heightPixels
    val dpi = realDisplayMetrics.densityDpi
} else {
    val displayMetrics = DisplayMetrics()
    windowManager.defaultDisplay.getMetrics(displayMetrics)
    try {
        val width = Display::class.java
                .getMethod("getRawWidth")
                .invoke(windowManager.defaultDisplay) as Int
        val height = Display::class.java
                .getMethod("getRawHeight")
                .invoke(windowManager.defaultDisplay) as Int
        val dpi = displayMetrics.densityDpi
    } catch (_: Exception) { }
}

Screen 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) { }
}
import android.util.DisplayMetrics
import android.view.Display
import android.view.WindowManager
import android.content.Context

val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    val realDisplayMetrics = DisplayMetrics()
    windowManager.defaultDisplay.getRealMetrics(realDisplayMetrics)
    val width = realDisplayMetrics.widthPixels
    val height = realDisplayMetrics.heightPixels
    val dpi = realDisplayMetrics.densityDpi
} else {
    val displayMetrics = DisplayMetrics()
    windowManager.defaultDisplay.getMetrics(displayMetrics)
    try {
        val width = Display::class.java
                .getMethod("getRawWidth")
                .invoke(windowManager.defaultDisplay) as Int
        val height = Display::class.java
                .getMethod("getRawHeight")
                .invoke(windowManager.defaultDisplay) as Int
        val dpi = displayMetrics.densityDpi
    } catch (_: Exception) { }
}

Longitude

현재 기기의 LastKnownLocation의 경도 값 입니다.

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();
}
import android.location.Location
import android.location.LocationManager

val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER)
val netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER)
val bestLocation: Location = when {
    (gpsLocation != null) and (netLocation != null) -> if (gpsLocation.accuracy < netLocation.accuracy) { gpsLocation } else { netLocation }
    (gpsLocation != null) -> gpsLocation
    else -> netLocation
} ?: return null

val latitude = bestLocation?.latitude
val longitude = bestLocation?.longitude
val altitude = bestLocation?.altitude
val speed = bestLocation?.speed

Latitude

현재 기기의 LastKnownLocation의 위도 값 입니다.

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();
}
import android.location.Location
import android.location.LocationManager

val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER)
val netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER)
val bestLocation: Location = when {
    (gpsLocation != null) and (netLocation != null) -> if (gpsLocation.accuracy < netLocation.accuracy) { gpsLocation } else { netLocation }
    (gpsLocation != null) -> gpsLocation
    else -> netLocation
} ?: return null

val latitude = bestLocation?.latitude
val longitude = bestLocation?.longitude
val altitude = bestLocation?.altitude
val speed = bestLocation?.speed

Altitude

현재 기기의 LastKnownLocation의 고도 값 입니다.

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();
}
import android.location.Location
import android.location.LocationManager

val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER)
val netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER)
val bestLocation: Location = when {
    (gpsLocation != null) and (netLocation != null) -> if (gpsLocation.accuracy < netLocation.accuracy) { gpsLocation } else { netLocation }
    (gpsLocation != null) -> gpsLocation
    else -> netLocation
} ?: return null

val latitude = bestLocation?.latitude
val longitude = bestLocation?.longitude
val altitude = bestLocation?.altitude
val speed = bestLocation?.speed

Speed

현재 기기의 LastKnownLocation의 속도 값 입니다.

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();
}
import android.location.Location
import android.location.LocationManager

val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER)
val netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER)
val bestLocation: Location = when {
    (gpsLocation != null) and (netLocation != null) -> if (gpsLocation.accuracy < netLocation.accuracy) { gpsLocation } else { netLocation }
    (gpsLocation != null) -> gpsLocation
    else -> netLocation
} ?: return null

val latitude = bestLocation?.latitude
val longitude = bestLocation?.longitude
val altitude = bestLocation?.altitude
val speed = bestLocation?.speed

Network Carrier

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

import android.telephony.TelephonyManager;

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

val telephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
val carrier = telephonyManager.networkOperatorName

Bluetooth Status

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

import android.bluetooth.BluetoothAdapter;

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

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

Cellular Status

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

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);
}
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.content.Context

val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    val activeNetwork = connectivityManager.activeNetwork
    val capabilities = connectivityManager.getNetworkCapabilities(activeNetwork)
    val cellularEnabled = capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)
} else {
    val networkInfo = connectivityManager.activeNetworkInfo
    val cellularEnabled = (networkInfo.type == ConnectivityManager.TYPE_MOBILE)
}

Wifi Status

해당 기기의 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);
}
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.content.Context

val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    val activeNetwork = connectivityManager.activeNetwork
    val capabilities = connectivityManager.getNetworkCapabilities(activeNetwork)
    val wifiEnabled = capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
} else {
    val networkInfo = connectivityManager.activeNetworkInfo
    val wifiEnabled = (networkInfo.type == ConnectivityManager.TYPE_WIFI)
}

Package Name

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

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

}
import android.content.pm.PackageManager
import android.content.Context

var packageName = ""
try {
    val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)
    packageName = packageInfo.packageName
} catch (e: PackageManager.NameNotFoundException) {

}

Version

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

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

}
import android.content.pm.PackageManager
import android.content.Context

var versionName = ""
try {
    val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)
    versionName = packageInfo.versionName
} catch (e: PackageManager.NameNotFoundException) {

}

Event Timestamp

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

System.currentTimeMillis();
System.currentTimeMillis()