android获取build和内存,分辨率等信息

更新时间:2023-06-27 19:38:16 阅读: 评论:0

Android获取Build和内存,分辨率等信息
protected void onCreate(Bundle savedInstanceState) {
tContentV iew(R.layout.main);
tvInfo = (TextV iew) findView ById(R.id.tvInfo);
tvInfo.tText(getBuildInfo(0) + getDisplayInfo(0) + getTelephonyState(0) + getTimeZoneInfo()  + getHardwareInfo(0));
/**
* @param type 0-All,1-Model,2-V ersionRelea,Other-Error.
* @return String
private String getBuildInfo(int type) {
台词练习
String model = Build.MODEL; // 型号
String versionRelea = Build.VERSION.RELEASE;
String versionSDK = Build.VERSION.SDK;
门市部String versionIncremental = Build.VERSION.INCREMENTAL;
String brand = Build.BRAND;
String id = Build.ID;
String manufacturer = Build.MANUFACTURER;
String hardware = Build.HARDWARE;
String product = Build.PRODUCT;
String cpuABI = Build.CPU_ABI;
String cpuABI2 = Build.CPU_ABI2;
String fingerPrint = Build.FINGERPRINT;
String board = Build.BOARD;
String rial = Build.SERIAL;
String ur = Build.USER;
if (type == 0) {
return Model: + model + \nV ersionRelea: + versionRelea + \nV ersionSDK: +
versionSDK + \nV ersionIncremental: + versionIncremental + \nBrand: + brand
+ \nID: + id + \nManufacturer: + manufacturer + \nHardware: + hardware
+ \nProduct: + product + \nCpuABI: + cpuABI + \nCpuABI2: + cpuABI2 +
\nFingerPrint: + fingerPrint + \nBoard: + board + \nSerial: + rial +
\nUr: + ur + \n
} el if (type == 1) {
return Model + model + \n
} el if (type == 2) {丹田发声
马淑洁
return V ersionRelea: + versionRelea + \n
} el {
return [getBuildInfo Err]
private String getHardwareInfo(int type) {
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);  WifiInfo wifiInfo = ConnectionInfo();
String macAddress = MacAddress();
String strCPU =
String[] cpuInfo = { , //1-cpu型号//2-cpu频率
String[] arrayOfStringCPU;
try {
FileReader fileReader = new FileReader( /proc/cpuinfo
BufferedReader localBufferedReader = new BufferedReader(fileReader, 8192);
strCPU = adLine();
arrayOfStringCPU = strCPU.split( \\s+
for (int i = 2; i arrayOfStringCPU.length; i++) {
cpuInfo[0] = cpuInfo[0] + arrayOfStringCPU[i] +怎么设置页码
strCPU = adLine();
arrayOfStringCPU = strCPU.split( \\s+
cpuInfo[1] += arrayOfStringCPU[2];
localBufferedReader.clo();
} catch (IOException e) {
e.printStackTrace();古罗马历史
// adb shell;cat /proc/meminfo
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();  ActivityManager activityManager = (ActivityManager) SystemService(
Context.ACTIVITY_SERVICE);
long mTotalMem = alMem;//0;
long mA vailMem = memoryInfo.availMem;
String strMemory;
String[] arrayOfStringMemory;中秋节的来历简单介绍
try {
FileReader localFileReader = new FileReader( /proc/meminfo
BufferedReader localBufferedReader = new BufferedReader(localFileReader, 8192);  strMemory = adLine();
arrayOfStringMemory = strMemory.split( \\s+
mTotalMem = Integer.valueOf(arrayOfStringMemory[1]).intV alue() * 1024;
localBufferedReader.clo();
} catch (IOException e) {
e.printStackTrace();
String totalMemory = Formatter.formatFileSize(this, mTotalMem);
String availMemory = Formatter.formatFileSize(this, mA vailMem);
if (type == 0) {
return MacAddress: + macAddress + \nCpuModel: + cpuInfo[0] + \nCpuClock: +
cpuInfo[1] + \nTotalMemory: + totalMemory + \nA vailableMemory: + availMemory  + \n
} el {
return
* @param type 0-All,1-DeviceId,2-SubscriberId,3-PhoneNumber,Other-Error.
* @return String
private String getTelephonyState(int type) {
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
String deviceId = DeviceId();
String subscriberId = SubscriberId();
String phoneNumber = Line1Number();
if (type == 0) {
苦苣苔return DeviceId: + deviceId + \nSubscriberId: + subscriberId + \nPhoneNumber: + phoneNumber + \n
} el if (type == 1) {
return DeviceId: + deviceId + \n
} el if (type == 2) {
return SubscriberId + subscriberId + \n
} el if (type == 3) {
return PhoneNumber: + phoneNumber + \n
} el {
return [getTelephonyState Err]
/**
* @param type 0-All,1-ScreenHeight,2-ScreenWidth,Other-Error.
* @return String
private String getDisplayInfo(int type) {
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int screenHeight = displayMetrics.heightPixels;

本文发布于:2023-06-27 19:38:16,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1053495.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:内存   练习   页码   古罗马   来历   台词
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图