Android获取硬件设备信息
2017-11-19 08:32
417 查看
此文介绍一些获取Android手机硬件信息的方法 主要是从Build和TelephonyManager中获取 以及使用反射获取SystemProperties
并使用他的get方法获取一些系统隐藏掉的API 以及某些ROM独有的数据 比如OPPO手机自己定制的osVersion ColorOS版本 OPPO手机ROM特有
分别获取了以下内容
列表内容
写的很烂 早期作品 千万不要喷我啊
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
[/code]
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
[/code]
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[/code]
我对某些函数的描述可能不太对 不要喷我哦
还有某些数据会获取不到 尤其手机号码 市面上大部分的SIM卡内置都没有手机号码 所以getLine1Number 根本就取不到
想获取的朋友可以google 百度 一般都是用发短信来实现的
并使用他的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; }1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
[/code]
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>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
[/code]
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>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[/code]
我对某些函数的描述可能不太对 不要喷我哦
还有某些数据会获取不到 尤其手机号码 市面上大部分的SIM卡内置都没有手机号码 所以getLine1Number 根本就取不到
想获取的朋友可以google 百度 一般都是用发短信来实现的
效果图
相关文章推荐
- android 获取设备硬件信息
- Android获取硬件设备信息
- Android获取硬件设备信息
- Android_获取手机设备信息device_id
- android 获取手机的设备信息
- Android设备信息IP地址等获取
- android系统获取系统相关信息(如Android设备的唯一ID等)原理
- android获取版本信息、屏幕信息和设备编号
- 获取Android设备的设备详细信息
- Android菜鸟笔记-获取设备信息
- Android设备信息攻略之硬件信息build
- Android 获取手机的IMEI等设备信息
- Android中获取设备的各种信息总结
- Android ADB工具-管理设备/取设备硬件信息(一)
- python获取android设备的GPS信息脚本分享
- Android 获取唯一设备号和机型信息
- *****Android设备信息获取
- [Android]获取设备相关信息
- 获取Android设备基本信息 TelephonyManager
- Unity3D的SystemInfo类,用于获取运行设备硬件信息(CPU、显卡、类型等)