Android(Java)

[Java] 디바이스 정보가져오기[모델명,OS버전,Device ID]

삽질중 2024. 3. 29. 15:15
 /**
 * Todo : 디바이스 모델명 가져오기
 * */
public static  String getDeviceModelName() {
    String deviceModel = Build.MODEL;
    return deviceModel;
}

/**
 * Todo : 안드로이드 OS 버전
 * ex : android 13
 * */
public static String osVersion() {
    return "android " + Build.VERSION.RELEASE;
}

/**
 * Todo : 안드로이드 디바이스 ID 가져오기
 * */
public static  String getDeviceId(Context context) {
    String deviceId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
    return deviceId;
}