此文介紹一些獲取Android手機硬件信息的方法 主要是從Build和TelephonyManager中獲取 以及使用反射獲取SystemProperties
並使用他的get方法獲取一些系統隱藏掉的API 以及某些ROM獨有的數據 比如OPPO手機自己定製的osVersion ColorOS版本 OPPO手機ROM特有
分別獲取了以下內容
- 列表內容
名稱 | 接口參數名稱 | 備註 | 示例 |
---|---|---|---|
序列號 | getDeviceId | 序列號IMEI | 865872025238821 |
andrlid_id | getString | android_id | bcbc00f09479aa5b |
手機號碼 | getLine1Number | 手機號碼 | 13117511178 |
手機卡序列號 | getSimSerialNumber | 手機卡序列號 | 89860179328595969501 |
IMSI | getSubscriberId | IMSI | 460017932859596 |
手機卡國家 | getSimCountryIso | 手機卡國家 | cn |
運營商 | getSimOperator | 運營商 | 46001 |
運營商名字 | getSimOperatorName | 運營商名字 | 中國聯通 |
國家iso代碼 | getNetworkCountryIso | 國家iso代碼 | cn |
網絡運營商類型 | getNetworkOperator | 返回MCC+MNC代碼 | (SIM卡運營商國家代碼和運營商網絡代碼)(IMSI) 46001 |
網絡類型名 | getNetworkOperatorName | 返回移動網絡運營商的名字(SPN) | 中國聯通 |
網絡類型 | getNetworkType | 3 | |
手機類型 | getPhoneType | 手機類型 | 1 |
手機卡狀態 | getSimState | 1 | |
mac地址 | getMacAddress | mac地址 | a8:a6:68:a3:d9:ef |
藍牙名稱 | getName | HUAWEI TAG-TL00 | |
返回系統版本 | getDeviceSoftwareVersion | null | |
CPU型號 | cpuinfo | CPU的型號 | MT6592 |
固件版本 | getRadioVersion | 無線電固件版本號,通常是不可用的 | MOLY.WR8.W1328.MD.TG.MP.V1.P22, 2014/07/15 19:57 |
Build系列 | android.os.Build | ||
---|---|---|---|
系統版本 | RELEASE | 獲取系統版本字符串。如4.1.2 或2.2 或2.3等 | 4.4.4 |
系統版本值 | SDK | 系統的API級別 一般使用下面大的SDK_INT 來查看 | 19 |
品牌 | BRAND | 獲取設備品牌 | Huawei |
型號 | MODEL | 獲取手機的型號 | HUAWEI G750-T01 |
ID | ID | 設備版本號 | HUAWEITAG-TLOO |
DISPLAY | DISPLAY | 獲取設備顯示的版本包(在系統設置中顯示爲版本號)和ID一樣 | TAG-TLOOCO1B166 |
產品名 | PRODUCT | 整個產品的名稱 | G750-T01 |
製造商 | MANUFACTURER | 獲取設備製造商 | HUAWEI |
設備名 | DEVICE | 獲取設備驅動名稱 | hwG750-T01 |
硬件 | HARDWARE | 設備硬件名稱,一般和基板名稱一樣(BOARD) | mt6592 |
指紋 | FINGERPRINT | 設備的唯一標識。由設備的多個信息拼接合成 | Huawei/G750-T01/hwG750-T01:4.2.2/HuaweiG750-T01/C00B152:user/ota-rel-keys,release-keys |
串口序列號 | SERIAL | 返回串口序列號 | YGKBBBB5C1711949 |
設備版本類型 | TYPE | 主要爲user 或eng. | user |
描述build的標籤 | TAGS | 設備標籤。如release-keys 或測試的 test-keys | release-keys |
設備主機地址 | HOST | 設備主機地址 | scmbuild |
設備用戶名 | USER | 基本上都爲android-build | queen |
固件開發版本代號 | codename | 設備當前的系統開發代號,一般使用REL代替 | REL |
源碼控制版本號 | build_incremental | 系統源代碼控制值,一個數字或者git hash值 | C01B166 |
主板 | board | 獲取設備基板名稱 | TAG-TL00 |
主板引導程序 | bootloader | 獲取設備引導程序版本號 | unkonwn |
Build時間 | time | Build時間 | 1476084456000 |
系統的API級別 | SDK_INT | 數字表示 | 19 |
cpu指令集1 | CPU_ABI | 獲取設備指令集名稱(CPU的類型) | arm64-v8a |
cpu指令集2 | CPU_ABI2 |
WifiManager | WIFI相關 | ||
---|---|---|---|
藍牙地址 | getAddress | 藍牙地址MAC地址 | 6a:cd:57:f2:3b:59 |
無線路由器名 | getSSID | WIFI名字 | 210e03fcf0 |
無線路由器地址 | getBSSID | ce:ea:8c:1a:5c:b2 | |
內網ip(wifl可用) | getIpAddress | 可以用代碼轉成192.168形式 | -2023511872 |
Display | 屏幕相關 | ||
---|---|---|---|
屏幕密度 | density | 屏幕密度(像素比例:0.75/1.0/1.5/2.0) | 2.0 |
屏幕密度 | densityDpi | 屏幕密度(每寸像素:120/160/240/320) | 480 |
手機內置分辨率 | getWidth | 內置好的不準確已廢棄API | 720 |
手機內置分辨率 | getHeight | 1184 | |
x像素 | xdpi | 屏幕x方向每英寸像素點數 | 422.03 |
Y像素 | ydpi | 屏幕y方向每英寸像素點數 | 424.069 |
字體縮放比例 | scaledDensity | 2.0 |
代碼
寫的很爛 早期作品 千萬不要噴我啊
private TelephonyManager phone;
private WifiManager wifi;
private Display display;
private DisplayMetrics metrics;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
phone = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
display = getWindowManager().getDefaultDisplay();
metrics = getResources().getDisplayMetrics();
init();
}
private void init() {
DisplayMetrics book=new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(book);
try {
Class localClass = Class.forName("android.os.SystemProperties");
Object localObject1 = localClass.newInstance();
Object localObject2 = localClass.getMethod("get", new Class[] { String.class, String.class }).invoke(localObject1, new Object[] { "gsm.version.baseband", "no message" });
Object localObject3 = localClass.getMethod("get", new Class[] { String.class, String.class }).invoke(localObject1, new Object[] { "ro.build.display.id",""});
setEditText(R.id.get,localObject2+"");
setEditText(R.id.osVersion,localObject3+"");
} catch (Exception e) {
e.printStackTrace();
}
//獲取網絡連接管理者
ConnectivityManager connectionManager = (ConnectivityManager)
getSystemService(CONNECTIVITY_SERVICE);
//獲取網絡的狀態信息,有下面三種方式
NetworkInfo networkInfo = connectionManager.getActiveNetworkInfo();
setEditText(R.id.lianwang,networkInfo.getType()+"");
setEditText(R.id.lianwangname,networkInfo.getTypeName());
setEditText(R.id.imei, phone.getDeviceId());
setEditText(R.id.deviceversion,phone.getDeviceSoftwareVersion());
setEditText(R.id.imsi, phone.getSubscriberId());
setEditText(R.id.number, phone.getLine1Number());
setEditText(R.id.simserial, phone.getSimSerialNumber());
setEditText(R.id.simoperator,phone.getSimOperator());
setEditText(R.id.simoperatorname, phone.getSimOperatorName());
setEditText(R.id.simcountryiso, phone.getSimCountryIso());
setEditText(R.id.workType,phone.getNetworkType()+"");
setEditText(R.id.netcountryiso,phone.getNetworkCountryIso());
setEditText(R.id.netoperator,phone.getNetworkOperator());
setEditText(R.id.netoperatorname,phone.getNetworkOperatorName());
setEditText(R.id.radiovis,android.os.Build.getRadioVersion());
setEditText(R.id.wifimac, wifi.getConnectionInfo().getMacAddress());
setEditText(R.id.getssid,wifi.getConnectionInfo().getSSID());
setEditText(R.id.getbssid,wifi.getConnectionInfo().getBSSID());
setEditText(R.id.ip,wifi.getConnectionInfo().getIpAddress()+"");
setEditText(R.id.bluemac, BluetoothAdapter.getDefaultAdapter()
.getAddress());
setEditText(R.id.bluname, BluetoothAdapter.getDefaultAdapter().getName()
);
setEditText(R.id.cpu,getCpuName());
setEditText(R.id.andrlid_id,
Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID));
setEditText(R.id.serial,android.os.Build.SERIAL);
setEditText(R.id.brand,android.os.Build.BRAND);
setEditText(R.id.tags, android.os.Build.TAGS);
setEditText(R.id.device,android.os.Build.DEVICE);
setEditText(R.id.fingerprint,android.os.Build.FINGERPRINT);
setEditText(R.id.bootloader, Build.BOOTLOADER);
setEditText(R.id.release, Build.VERSION.RELEASE);
setEditText(R.id.sdk,Build.VERSION.SDK);
setEditText(R.id.sdk_INT,Build.VERSION.SDK_INT+"");
setEditText(R.id.codename,Build.VERSION.CODENAME);
setEditText(R.id.incremental,Build.VERSION.INCREMENTAL);
setEditText(R.id.cpuabi, android.os.Build.CPU_ABI);
setEditText(R.id.cpuabi2, android.os.Build.CPU_ABI2);
setEditText(R.id.board, android.os.Build.BOARD);
setEditText(R.id.model, android.os.Build.MODEL);
setEditText(R.id.product, android.os.Build.PRODUCT);
setEditText(R.id.type, android.os.Build.TYPE);
setEditText(R.id.user, android.os.Build.USER);
setEditText(R.id.disply, android.os.Build.DISPLAY);
setEditText(R.id.hardware, android.os.Build.HARDWARE);
setEditText(R.id.host, android.os.Build.HOST);
setEditText(R.id.changshang, android.os.Build.MANUFACTURER);
setEditText(R.id.phonetype,phone.getPhoneType()+"");
setEditText(R.id.simstate,phone.getSimState()+"");
setEditText(R.id.b_id, Build.ID);
setEditText(R.id.gjtime,android.os.Build.TIME+"");
setEditText(R.id.width,display.getWidth()+"");
setEditText(R.id.height,display.getHeight()+"");
setEditText(R.id.dpi,book.densityDpi+"");
setEditText(R.id.density,book.density+"");
setEditText(R.id.xdpi,book.xdpi+"");
setEditText(R.id.ydpi,book.ydpi+"");
setEditText(R.id.scaledDensity,book.scaledDensity+"");
//setEditText(R.id.wl,getNetworkState(this)+"");
// 方法2
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width=dm.widthPixels;
int height=dm.heightPixels;
setEditText(R.id.xwidth,width+"");
setEditText(R.id.xheight,height+"");
}
private void setEditText(int id, String s) {
((TextView) this.findViewById(id)).setText(s);
}
/**
* 獲取CPU型號
* @return
*/
public static String getCpuName(){
String str1 = "/proc/cpuinfo";
String str2 = "";
try {
FileReader fr = new FileReader(str1);
BufferedReader localBufferedReader = new BufferedReader(fr);
while ((str2=localBufferedReader.readLine()) != null) {
if (str2.contains("Hardware")) {
return str2.split(":")[1];
}
}
localBufferedReader.close();
} catch (IOException e) {
}
return null;
}
XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.lyq.test.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout style="@style/Item.Layout">
<TextView
android:id="@+id/lianwang"
style="@style/Item.Edit"
android:inputType="number" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="聯網方式"
/>
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:id="@+id/lianwangname"
style="@style/Item.Edit"
android:inputType="number" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="聯網方式名稱"
/>
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:id="@+id/imei"
style="@style/Item.Edit"
android:hint="請輸入IMEI"
android:inputType="number" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="IMEI"
/>
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="返回系統版本"/>
<TextView
android:id="@+id/deviceversion"
style="@style/Item.Edit"
android:hint="返回系統版本"
/>
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="IMSI"/>
<TextView
android:id="@+id/imsi"
style="@style/Item.Edit"
android:hint="請輸入IMSI"
/>
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="手機號碼"/>
<TextView
android:id="@+id/number"
style="@style/Item.Edit"
android:hint="請輸入手機號碼"
/>
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="手機卡序列號" />
<TextView
android:id="@+id/simserial"
style="@style/Item.Edit"
android:inputType="number" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="運營商" />
<TextView
android:id="@+id/simoperator"
style="@style/Item.Edit"
android:hint="simoperator"
/>
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="運營商名字" />
<TextView
android:id="@+id/simoperatorname"
style="@style/Item.Edit"
android:hint="simoperator"
android:inputType="number" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="國家iso代碼" />
<TextView
android:id="@+id/simcountryiso"
style="@style/Item.Edit"
android:hint="請輸入"
android:inputType="number" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="網絡類型" />
<TextView
android:id="@+id/workType"
style="@style/Item.Edit"
android:hint="網絡類型"
android:inputType="number" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="手機卡國家" />
<TextView
android:id="@+id/netcountryiso"
style="@style/Item.Edit"
android:hint="手機卡國家"
android:inputType="number" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="網絡運營商類型" />
<TextView
android:id="@+id/netoperator"
style="@style/Item.Edit"
android:hint="網絡運營商類型"
android:inputType="number" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="網絡類型名" />
<TextView
android:id="@+id/netoperatorname"
style="@style/Item.Edit"
android:hint="網絡類型名"
android:inputType="number" />
</RelativeLayout>
<!-- <RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="網絡類型" />
<TextView
android:id="@+id/wl"
style="@style/Item.Edit"
android:hint="網絡類型"
android:inputType="number" />
</RelativeLayout>
-->
<RelativeLayout style="@style/Item.Layout" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="固件版本" />
<TextView
android:id="@+id/radiovis"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="mac地址" />
<TextView
android:id="@+id/wifimac"
style="@style/Item.Edit"
android:hint="mac地址" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="無線路由器名" />
<TextView
android:id="@+id/getssid"
style="@style/Item.Edit"
android:hint="無線路由器名" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="無線路由器地址" />
<TextView
android:id="@+id/getbssid"
style="@style/Item.Edit"
android:hint="無線路由器地址" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="藍牙地址" />
<TextView
android:id="@+id/bluemac"
style="@style/Item.Edit"
android:hint="藍牙地址" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="藍牙名稱" />
<TextView
android:id="@+id/bluname"
style="@style/Item.Edit"
android:hint="請輸入藍牙name" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="andrlid_id" />
<TextView
android:id="@+id/andrlid_id"
style="@style/Item.Edit"
android:hint="請輸入Android ID" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="串口序列號" />
<TextView
android:id="@+id/serial"
style="@style/Item.Edit"
android:hint="串口序列號" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="品牌" />
<TextView
android:id="@+id/brand"
style="@style/Item.Edit"
android:hint="品牌" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="get" />
<TextView
android:id="@+id/get"
style="@style/Item.Edit"
android:hint="get" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="osVersion" />
<TextView
android:id="@+id/osVersion"
style="@style/Item.Edit"
android:hint="osVersion" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="描述build的標籤" />
<TextView
android:id="@+id/tags"
style="@style/Item.Edit"
android:hint="描述build的標籤" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="設備名" />
<TextView
android:id="@+id/device"
style="@style/Item.Edit"
android:hint="設備名" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="主板引導程序" />
<TextView
android:id="@+id/bootloader"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="系統版本" />
<TextView
android:id="@+id/release"
style="@style/Item.Edit"
android:hint="系統版本" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="系統版本值" />
<TextView
android:id="@+id/sdk"
style="@style/Item.Edit"
android:hint="系統版本值" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="系統的API級別" />
<TextView
android:id="@+id/sdk_INT"
style="@style/Item.Edit"
android:hint="系統的API級別" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="固件開發版本代號" />
<TextView
android:id="@+id/codename"
style="@style/Item.Edit"
android:hint="固件開發版本代號" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="源碼控制版本號" />
<TextView
android:id="@+id/incremental"
style="@style/Item.Edit"
android:hint="源碼控制版本號" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="CPU型號" />
<TextView
android:id="@+id/cpu"
style="@style/Item.Edit"
android:hint="CPU型號" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="cpu指令集" />
<TextView
android:id="@+id/cpuabi"
style="@style/Item.Edit"
android:hint="cpu指令集" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="cpu指令集2" />
<TextView
android:id="@+id/cpuabi2"
style="@style/Item.Edit"
android:hint="" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="主板" />
<TextView
android:id="@+id/board"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="型號" />
<TextView
android:id="@+id/model"
style="@style/Item.Edit"
android:hint="請輸入型號" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="產品名稱" />
<TextView
android:id="@+id/product"
style="@style/Item.Edit"
android:hint="請輸入型號" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="設備版本類型" />
<TextView
android:id="@+id/type"
style="@style/Item.Edit"
android:hint="設備版本類型" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="設備用戶名" />
<TextView
android:id="@+id/user"
style="@style/Item.Edit"
android:hint="設備用戶名" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="顯示屏幕參數" />
<TextView
android:id="@+id/disply"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="硬件名稱" />
<TextView
android:id="@+id/hardware"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="設備主機地址" />
<TextView
android:id="@+id/host"
style="@style/Item.Edit"
android:hint="設備主機地址" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="製造商" />
<TextView
android:id="@+id/changshang"
style="@style/Item.Edit"
android:hint="製造商" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="手機類型" />
<TextView
android:id="@+id/phonetype"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="手機卡狀態" />
<TextView
android:id="@+id/simstate"
style="@style/Item.Edit"
android:hint="手機卡狀態" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ID" />
<TextView
android:id="@+id/b_id"
style="@style/Item.Edit"
android:hint="ID" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="內網ip" />
<TextView
android:id="@+id/ip"
style="@style/Item.Edit"
android:hint="內網ip" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Build時間" />
<TextView
android:id="@+id/gjtime"
style="@style/Item.Edit"
android:hint="Build時間" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="指紋" />
<TextView
android:id="@+id/fingerprint"
style="@style/Item.Edit"
android:hint="指紋" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" ---------------手機屏幕信息--------------"
/>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="手機內置 寬" />
<TextView
android:id="@+id/width"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="手機內置 高" />
<TextView
android:id="@+id/height"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="當前分辨率" />
<TextView
android:id="@+id/xwidth"
style="@style/Item.Edit"
android:hint="當前分辨率" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="當前分辨率" />
<TextView
android:id="@+id/xheight"
style="@style/Item.Edit"
android:hint="當前分辨率" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="dpi" />
<TextView
android:id="@+id/dpi"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="density" />
<TextView
android:id="@+id/density"
style="@style/Item.Edit"
android:hint="請輸入" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="x像素" />
<TextView
android:id="@+id/xdpi"
style="@style/Item.Edit"
android:hint="x像素" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Y像素" />
<TextView
android:id="@+id/ydpi"
style="@style/Item.Edit"
android:hint="Y像素" />
</RelativeLayout>
<RelativeLayout style="@style/Item.Layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="字體縮放比例" />
<TextView
android:id="@+id/scaledDensity"
style="@style/Item.Edit"
android:hint="字體縮放比例" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
values配置信息
<style name="Item">
<item name="android:textColor">@android:color/black</item>
</style>
<style name="Item.Layout">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">50dip</item>
<item name="android:orientation">vertical</item>
</style>
<style name="Item.Label">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="Item.Edit">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_marginLeft">120dip</item>
<item name="android:layout_marginRight">100dip</item>
</style>
我對某些函數的描述可能不太對 不要噴我哦
還有某些數據會獲取不到 尤其手機號碼 市面上大部分的SIM卡內置都沒有手機號碼 所以getLine1Number 根本就取不到
想獲取的朋友可以google 百度 一般都是用發短信來實現的