900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > android获取操作系统版本号 Android 获取手机的厂商 型号 Android系统版本号 IME

android获取操作系统版本号 Android 获取手机的厂商 型号 Android系统版本号 IME

时间:2022-08-14 15:39:29

相关推荐

android获取操作系统版本号 Android 获取手机的厂商 型号 Android系统版本号 IME

1、获取手机制造厂商

2、获取手机型号

3、获取手机系统当前使用的语言

4、获取Android系统版本号

5、获取手机IMEI串号

6、获取手机中的语言列表

SystemUtil类

1.

/**

2.

*系统工具类

3.

*Createdbyzhuwentaoon-07-18.

4.

*/

5. public class SystemUtil{

6.

7.

/**

8.

*获取当前手机系统语言。

9.

*

10. *@return返回当前系统语言。例如:当前设置的是“中文-中国”,则返回“zh-CN”

11. */

12. public static StringgetSystemLanguage(){

13. return Locale.getDefault().getLanguage();

14. }

15.

16. /**

17. *获取当前系统上的语言列表(Locale列表)

18. *

19. *@return语言列表

20. */

21. public static Locale[]getSystemLanguageList(){

22. return Locale.getAvailableLocales();

23. }

24.

25. /**

26. *获取当前手机系统版本号

27. *

28. *@return系统版本号

29. */

30. public static StringgetSystemVersion(){

31. return android.os.Build.VERSION.RELEASE;

32. }

33.

34. /**

35. *获取手机型号

36. *

37. *@return手机型号

38. */

39. public static StringgetSystemModel(){

40. return android.os.Build.MODEL;

41. }

42.

43. /**

44. *获取手机厂商

45. *

46. *@return手机厂商

47. */

48. public static StringgetDeviceBrand(){

49. return android.os.Build.BRAND;

50. }

51.

52. /**

53. *获取手机IMEI(需要“android.permission.READ_PHONE_STATE”权限)

54. *

55. *@return手机IMEI

56. */

57. public static StringgetIMEI(Contextctx){

58. TelephonyManagertm=(TelephonyManager)ctx.getSystemService(Activity.TELEPHONY_SERVICE);

59. if (tm!= null){

60. return tm.getDeviceId();

61. }

62. return null;

63. }

64. }

其中获取手机IMEI需要在AndroidManifest.xml中加上权限:

1. android:name="android.permission.READ_PHONE_STATE" />

使用这些方法的时候直接调用就好了

1. private void showSystemParameter(){

2.

StringTAG="系统参数:";

3.

Log.e(TAG,"手机厂商:"+SystemUtil.getDeviceBrand());

4.

Log.e(TAG,"手机型号:"+SystemUtil.getSystemModel());

5.

Log.e(TAG,"手机当前系统语言:"+SystemUtil.getSystemLanguage());

6.

Log.e(TAG,"Android系统版本号:"+SystemUtil.getSystemVersion());

7.

Log.e(TAG,"手机IMEI:"+SystemUtil.getIMEI(getApplicationContext()));

8.

}

返回结果:

IMEI号,IESI号,手机型号:

privatevoidgetInfo(){

TelephonyManagermTm=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);

Stringimei=mTm.getDeviceId();

Stringimsi=mTm.getSubscriberId();

Stringmtype=android.os.Build.MODEL; //手机型号

Stringnumer=mTm.getLine1Number(); //手机号码,有的可得,有的不可得

}

手机型号 Build.MODEL

The end-user-visible name for the end product.

sdk版本 Build.VERSION.SDK

This constant is deprecated. Use SDK_INT to easily get this as an integer.

及frimware版本号(系统版本号)Build.VERSION.RELEASE

The user-visible version string.

事实上,Build能向我们提供包括 硬件厂商,硬件编号,序列号等很多信息 调用方法也都同上,很简单。

The name of the underlying board, like "goldfish".

The system bootloader version number.

The brand (e.g., carrier) the software is customized for, if any.

The name of the instruction set (CPU type + ABI convention) of native code.

The name of the second instruction set (CPU type + ABI convention) of native code.

The name of the industrial design.

A build ID string meant for displaying to the user

A string that uniquely identifies this build.

The name of the hardware (from the kernel command line or /proc).

Either a changelist number, or a label like "M4-rc20".

The manufacturer of the product/hardware.

The end-user-visible name for the end product.

The name of the overall product.

The radio firmware version number.

A hardware serial number, if available.

Comma-separated tags describing the build, like "unsigned,debug".

long

The type of build, like "user" or "eng".

Value used for when a build property is unknown.

明确几个概念:

SIM卡存储的数据可分为四类:

第一类是固定存放的数据。这类数据在移动电话机被出售之前由SIM卡中心写入,包括国际移动用户识别号(IMSI)、鉴权密钥(KI)、鉴权和加密算法等等。

第二类是暂时存放的有关网络的数据。如位置区域识别码(LAI)、移动用户暂时识别码(TMSI)、禁止接入的公共电话网代码等。

第三类是相关的业务代码,如个人识别码(PIN)、解锁码(PUK)、计费费率等。

第四类是电话号码簿,是手机用户随时输入的电话号码。用户全部资料几乎都存储在SIM卡内,因此SIM卡又称为用户资料识别卡。

IMSI是一个唯一的数字, 标识了GSM和UMTS网络里的唯一一个用户.它存储 在手机的SIM卡里,它会通过手机发送到网络上.IMSI与SIM唯一对应

IMEI也是一串唯一的数字, 标识了GSM和UMTS网络里的唯一一个手机.它通常被打印在手机里电池下面的那一面,拨*#06#也能看到它.IMEI与设备唯一对应.

1。IMEI不存在于SIM卡中,它是手机本身的串号。

2。通常我们所说的手机号也不存在于SIM卡中,虽然SIM卡中有一个专门存储SIM卡本身号码的地方,但是此号码是通过手工设定的,而且是可以更改的。SIM卡的识别通常使用IMSI号,这个对于SIM卡是唯一的。

3。使用SimGetRecordInfo之类的函数获得SIM卡的IMSI号码能否成功依赖于设备制造商是否实现了此函数,据我所知在DOPOD的机器上是可以获得,但是在联想的机器上却不行,其他机器没有。

4。获得IMEI以及IMSI可以通过RIL或者TAPI中的LINE操作的函数获得。

记得添加权限:

Android:name="android.permission.READ_PHONE_STATE" />

获取手机屏幕高度:

privatevoidgetWeithAndHeight(){

//这种方式在service中无法使用,

DisplayMetricsdm= newDisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(dm);

Stringwidth=dm.widthPixels; //宽

Stringheight=dm.heightPixels; //高

//在service中也能得到高和宽

WindowManagermWindowManager=(WindowManager)getSystemService(Context.WINDOW_SERVICE);

width=mWindowManager.getDefaultDisplay().getWidth();

height=mWindowManager.getDefaultDisplay().getHeight();

}

获取手机MAC地址:

privateStringgetMacAddress(){

Stringresult= "";

WifiManagerwifiManager=(WifiManager)getSystemService(Context.WIFI_SERVICE);

WifiInfowifiInfo=wifiManager.getConnectionInfo();

result=wifiInfo.getMacAddress();

Log.i(TAG, "macAdd:"+result);

returnresult;

}

手机CPU信息

privateString[]getCpuInfo(){

Stringstr1= "/proc/cpuinfo";

Stringstr2= "";

String[]cpuInfo={"",""};//1-cpu型号//2-cpu频率

String[]arrayOfString;

try{

FileReaderfr= newFileReader(str1);

BufferedReaderlocalBufferedReader= newBufferedReader(fr,8192);

str2=localBufferedReader.readLine();

arrayOfString=str2.split("\\s+");

for(inti=2;i< arrayOfString.length; i++) {

cpuInfo[0]=cpuInfo[0]+arrayOfString[i]+"";

}

str2=localBufferedReader.readLine();

arrayOfString=str2.split("\\s+");

cpuInfo[1]+=arrayOfString[2];

localBufferedReader.close();

} catch(IOExceptione){

}

Log.i(TAG, "cpuinfo:"+cpuInfo[0]+""+cpuInfo[1]);

returncpuInfo;

}

网上收集的一些获取收集信息的代码,制作成一个工具类,以后可以方便调用。

android获取操作系统版本号 Android 获取手机的厂商 型号 Android系统版本号 IMEI 当前系统语言等工具类...

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。