Files
EchoLink/app/src/main/java/com/nbee/echolink/utils/DeviceInfoUtils.java

163 lines
3.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.nbee.echolink.utils;
import java.util.Locale;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.Log;
public class DeviceInfoUtils {
/**
* 获取设备宽度px
*
*/
public static int getDeviceWidth(Context context) {
return context.getResources().getDisplayMetrics().widthPixels;
}
/**
* 获取设备高度px
*/
public static int getDeviceHeight(Context context) {
return context.getResources().getDisplayMetrics().heightPixels;
}
/**
* 获取厂商名
**/
public static String getDeviceManufacturer() {
return android.os.Build.MANUFACTURER;
}
/**
* 获取产品名
**/
public static String getDeviceProduct() {
return android.os.Build.PRODUCT;
}
/**
* 获取手机品牌
*/
public static String getDeviceBrand() {
return android.os.Build.BRAND;
}
/**
* 获取手机型号
*/
public static String getDeviceModel() {
return android.os.Build.MODEL;
}
/**
* 获取手机主板名
*/
public static String getDeviceBoard() {
return android.os.Build.BOARD;
}
/**
* 设备名
**/
public static String getDeviceDevice() {
return android.os.Build.DEVICE;
}
/**
*
*
* fingerprit 信息
**/
public static String getDeviceFubgerprint() {
return android.os.Build.FINGERPRINT;
}
/**
* 硬件名
*
**/
public static String getDeviceHardware() {
return android.os.Build.HARDWARE;
}
/**
* 主机
*
**/
public static String getDeviceHost() {
return android.os.Build.HOST;
}
/**
*
* 显示ID
**/
public static String getDeviceDisplay() {
return android.os.Build.DISPLAY;
}
/**
* ID
*
**/
public static String getDeviceId() {
return android.os.Build.ID;
}
/**
* 获取手机用户名
*
**/
public static String getDeviceUser() {
return android.os.Build.USER;
}
/**
* 获取手机 硬件序列号
**/
public static String getDeviceSerial() {
return android.os.Build.SERIAL;
}
/**
* 获取手机Android 系统SDK
*
* @return
*/
public static int getDeviceSDK() {
return android.os.Build.VERSION.SDK_INT;
}
/**
* 获取手机Android 版本
*
* @return
*/
public static String getDeviceAndroidVersion() {
return android.os.Build.VERSION.RELEASE;
}
/**
* 获取当前手机系统语言。
*/
public static String getDeviceDefaultLanguage() {
return Locale.getDefault().getLanguage();
}
/**
* 获取当前系统上的语言列表(Locale列表)
*/
public static String getDeviceSupportLanguage() {
Log.e("wangjie", "Local:" + Locale.GERMAN);
Log.e("wangjie", "Local:" + Locale.ENGLISH);
Log.e("wangjie", "Local:" + Locale.US);
Log.e("wangjie", "Local:" + Locale.CHINESE);
Log.e("wangjie", "Local:" + Locale.TAIWAN);
Log.e("wangjie", "Local:" + Locale.FRANCE);
Log.e("wangjie", "Local:" + Locale.FRENCH);
Log.e("wangjie", "Local:" + Locale.GERMANY);
Log.e("wangjie", "Local:" + Locale.ITALIAN);
Log.e("wangjie", "Local:" + Locale.JAPAN);
Log.e("wangjie", "Local:" + Locale.JAPANESE);
return Locale.getAvailableLocales().toString();
}
}