[实例] 获取手机设备的唯一码(uniquely_code)的方法

在这个接口说明中,需要传递一个手机设备的唯一码(uniquely_code)的参数,一般来说,我们可以使用IMIE,其获取方法也比较简单,代码如下:
  1. public void fetch_status(){  
  2.     TelephonyManager tm = (TelephonyManager) this  
  3.     .getSystemService(Context.TELEPHONY_SERVICE);//      
  4.     String str = "";  
  5.     str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n";   
  6.     str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n";   
  7.     str += "Line1Number = " + tm.getLine1Number() + "\n";   
  8.     str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n";   
  9.     str += "NetworkOperator = " + tm.getNetworkOperator() + "\n";   
  10.     str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n";   
  11.     str += "NetworkType = " + tm.getNetworkType() + "\n";   
  12.     str += "honeType = " + tm.getPhoneType() + "\n";   
  13.     str += "SimCountryIso = " + tm.getSimCountryIso() + "\n";   
  14.     str += "SimOperator = " + tm.getSimOperator() + "\n";   
  15.     str += "SimOperatorName = " + tm.getSimOperatorName() + "\n";   
  16.     str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n";   
  17.     str += "SimState = " + tm.getSimState() + "\n";   
  18.     str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";   
  19.     str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n";   
  20.     TextView sys = (TextView) findViewById(R.id.sys);  
  21.     sys.setText(str);  
  22. }  
复制代码
注意:
str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n";


希望对大家有用。
啥时变成机器人....
懂点安全,对互联网还心存幻想的程序员…
Blog: http://iceskysl.1sters.com

学习。

TOP

现在不太懂,慢慢学习中
初级程序员

TOP

先收藏了,以后估计会用到
谢谢楼主分享
每天进步一点点

TOP

有用的好帖~~~顶起
我的Android,我做主

TOP

很好啊。多多提供好的应用接口啊。

TOP

学习啦

TOP

tm.getLine1Number()这个方法在WCDMA的手机获取不到手机号码啊。
认真做自己!!!

TOP

电话号码算隐私信息了~比较敏感~
管不了天, 也管不了地,最大目标是管好eoe

TOP

我觉得收费软件绑定SIM或者电话号码比较人性化。有可能换一台Android手机,继续使用原来的软件和串号......

随便说说

TOP

NULL可以么?
用模拟器的话,System.getString(this.getContentResolver(), System.ANDROID_ID);  返回的是 ...
yanx730 发表于 2009-10-28 18:40


NULL不可以哦~

TOP

正在找相关资料耶,太谢谢老

TOP

哈哈,收藏先,以后可能需要

TOP

NULL可以么?
用模拟器的话,System.getString(this.getContentResolver(), System.ANDROID_ID);  返回的是null

TOP

在开发中,应用要和设备绑定的话,只能获取IMEI号,是不是只能使用这个str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n";
还有其他方法吗?

TOP

强烈推荐 关闭


2010 Google AdSense 合作伙伴日移动专场研讨会大招募!

eoeandroid的创始人之一,eoe公司CTO 姚尚朗(iceskysl)受到 Google 邀请,将在三个城市的《2010 Google AdSense 合作伙伴日移动专场研讨会》上做主题发言, .. ...


查看