- 浏览: 553262 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
0759cxz:
good job!
Android 同时使用多个library时的问题 -
zhouxiaoli521:
lgj452555712 写道cursor 没有关闭,最好加上 ...
Android sqlite中判断某个表是否存在方法 -
lgj452555712:
cursor 没有关闭,最好加上finally 后关上fina ...
Android sqlite中判断某个表是否存在方法 -
zhouxiaoli521:
zhouxiaoli521 写道weinifk 写道publi ...
StringBuffer的setLength -
zhouxiaoli521:
weinifk 写道public static void ma ...
StringBuffer的setLength
Android开发平台中,可通过TelephonyManager 获取本机号码。
TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE); txtPhoneNumber.setText(phoneMgr.getLine1Number()); //txtPhoneNumber是一个EditText 用于显示手机号
注:
根据Android的安全机制,在使用TelephonyManager时,必须在AndroidManifest.xml中添加<uses-permission android:name="READ_PHONE_STATE" /> 否则无法获得系统的许可。
手机型号 Build.MODEL
String | MODEL | The end-user-visible name for the end product. |
sdk版本 Build.VERSION.SDK
String | SDK | This constant is deprecated. Use SDK_INT to easily get this as an integer. |
及frimware版本号(系统版本号) Build.VERSION.RELEASE
String | RELEASE | The user-visible version string. |
private void loadPhoneStatus() { TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE); txtPhoneModel.setText(Build.MODEL); //手机型号 txtPhoneNumber.setText(phoneMgr.getLine1Number());//本机电话号码 txtSdkVersion.setText(Build.VERSION.SDK);//SDK版本号 txtOsVersion.setText(Build.VERSION.RELEASE);//Firmware/OS 版本号 }
事实上,Build能向我们提供包括 硬件厂商,硬件编号,序列号等很多信息 调用方法也都同上,很简单。
String | BOARD | The name of the underlying board, like "goldfish". |
String | BOOTLOADER | The system bootloader version number. |
String | BRAND | The brand (e.g., carrier) the software is customized for, if any. |
String | CPU_ABI | The name of the instruction set (CPU type + ABI convention) of native code. |
String | CPU_ABI2 | The name of the second instruction set (CPU type + ABI convention) of native code. |
String | DEVICE | The name of the industrial design. |
String | DISPLAY | A build ID string meant for displaying to the user |
String | FINGERPRINT | A string that uniquely identifies this build. |
String | HARDWARE | The name of the hardware (from the kernel command line or /proc). |
String | HOST | |
String | ID | Either a changelist number, or a label like "M4-rc20". |
String | MANUFACTURER | The manufacturer of the product/hardware. |
String | MODEL | The end-user-visible name for the end product. |
String | PRODUCT | The name of the overall product. |
String | RADIO | The radio firmware version number. |
String | SERIAL | A hardware serial number, if available. |
String | TAGS | Comma-separated tags describing the build, like "unsigned,debug". |
long | TIME | |
String | TYPE | The type of build, like "user" or "eng". |
String | UNKNOWN | Value used for when a build property is unknown. |
String |
USER |
=================================================
首先我们来明确几个概念:
SIM卡存储的数据可分为四类: 第一类是固定存放的数据。这类数据在移动电话机被出售之前由SIM卡中心写入,包括国际移动用户识别号(IMSI)、鉴权密钥(KI)、鉴权和加密算法等等。 第二类是暂时存放的有关网络的数据。如位置区域识别码(LAI)、移动用户暂时识别码(TMSI)、禁止接入的公共电话网代码等。 第三类是相关的业务代码,如个人识别码(PIN)、解锁码(PUK)、计费费率等。 第四类是电话号码簿,是手机用户随时输入的电话号码。用户全部资料几乎都存储在SIM卡内,因此SIM卡又称为用户资料识别卡。
IMSI是一个唯一的数字, 标识了GSM和UMTS 网络里的唯一一个用户. 它存储 在手机的SIM卡里,它会通过手机发送到网络上. IMSI 与 SIM唯一对应 IMEI也是一串唯一的数字, 标识了 GSM 和 UMTS网络里的唯一一个手机.它通常被打印在手机里电池下面的那一面,拨 *#06# 也能看到它. IMEI 与 设备唯一对应. 1。IMEI不存在于SIM卡中,它是手机本身的串号。
下面给出获取手机本机号码的代码: TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
String deviceid = tm.getDeviceId(); String tel = tm.getLine1Number(); String imei = tm.getSimSerialNumber(); String imsi = tm.getSubscriberId();
添加权限: <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 注意,手机号码不是所有的都能获取。只是有一部分可以拿到。这个是由于移动运营商没有把手机号码的数据写入到sim卡中。这个就像是一个变量,当移动运营商为它赋值了,它自然就会有值。不赋值自然为空。这就是为什么很多人得不到本机号码的原因。
2。通常我们所说的手机号也不存在于SIM卡中,虽然SIM卡中有一个专门存储SIM卡本身号码的地方,但是此号码是通过手工设定的,而且是可以更改的。 SIM卡的识别通常使用IMSI号,这个对于SIM卡是唯一的。
3。使用SimGetRecordInfo之类的函数获得SIM卡的IMSI号码能否成功依赖于设备制造商是否实现了此函数,据我所知在DOPOD的机器上是可以获得,但是在联想的机器上却不行,其他机器没有。
4。获得IMEI以及IMSI可以通过RIL或者TAPI中的LINE操作的函数获得。
http://archive.cnblogs.com/a/1931248/
http://blog.csdn.net/lifanupc/archive/2010/07/08/5721484.aspx
发表评论
-
Android NDK开发环境搭建_r8
2014-04-23 16:32 1036本文主内容: 1、 Android NDK 安装 2、 ... -
Android java.lang.VerifyError 异常解决办法
2014-04-01 13:58 4539通常这个异常的问题出现在jar包上 我的情况是 sdk ... -
Android —— 关于ADT 17的BuildConfig.DEBUG
2014-03-21 11:02 1111在日常开发中,我们使用android.util.Lo ... -
Android 让多个Fragment 切换时不重新实例化
2013-12-05 18:48 1417在项目中需要进行Fragment的切换,一直都是用repla ... -
android学习—— context 和 getApplicationContext()
2013-09-22 11:08 1892在android中常常会遇到与context有关的内容 浅 ... -
Android requestFeature() must be called before adding content
2013-07-08 17:18 2307E/AndroidRuntime( 408): androi ... -
Android onActivityResult和横屏
2013-06-20 16:48 1789做一个项目 页面强制横屏 两个activity需要交互 现 ... -
Android 无法加载fragment的问题
2013-06-17 14:42 2396在项目中继承了fragment 重写了构造函数 make ... -
android源码解读一(Context)
2013-04-27 19:16 1714Context类 Context是一个抽象类 publi ... -
Android 4.1 动态加载APK中的资源
2013-04-24 17:29 4145*** is not owned by the curr ... -
Android ADT中增大AVD内存后无法启动:emulator failed to allocate memory 8
2013-04-15 15:45 1740过程中,增大对应AVD的 ... -
Android下面的MD5加密
2013-04-08 12:17 955网上关于android下MD5加密的资料很多,但是测试了下 ... -
Android 调用系统应用程序信息(Application Info)界面
2013-03-15 18:30 1231“Android系统设置->应用程序->管理应用 ... -
Android Dialog背景透明和黑暗度
2013-03-14 18:20 4031设置透明度,主要设置的是dialog自身的透明度 ... -
全局监听SCREEN_ON和SCREEN_OFF的替代方法--监听屏幕解锁事件
2013-03-08 12:17 3004在做一个程序的时候,需要时刻保持某一服务是启动的, ... -
Android 退出应用程序
2013-01-21 10:53 895android.os.Process.killProcess ... -
Android控件WebView(浏览器)常用功能(图片、缩放)例子介绍
2012-11-06 11:03 2498Android系统默认提供WebView控件(view)来在应 ... -
Android ProgressBar使用.9图在部分android手机上显示异常!
2012-11-05 10:18 2098写道 我使用的是progressbar.xml配置文 ... -
Android 同时使用多个library时的问题
2012-10-29 12:40 1547剧情是这样,我的app要使用两个library,如:Li ... -
android圆形进度条ProgressBar颜色设置
2012-07-29 15:14 1301总结的挺全面 http://aichixihongshi.i ...
相关推荐
Meizu 魅族M9 手机的Android系统ROOT工具 适用于固件版本为16428 firmware或以下版本的Android 2.2,不适用固件版本为17831 firmware或以上版本的Android 2.3.1。
DreamPro2的固件,版本是V1.7。适合DreamPro2编程器的固件升级使用,并非编程器软件。
DreamPro2编程器固件V1.9版本,官网没有下载资源了,需要的拿去吧。这个是编程器的固件升级文件,不是编程器软件。
固件详情 存档名称: A95X R1电视盒Android Lollipop 5.1.1固件 图片: A95X R1电视盒...●Android 6.0版本为您提供使用所有最新更新和访问权限的好处平稳地播放商店中的所有工具,游戏和应用程序 ●WiFi芯片:RTL8189
Manufacturing Tool V2 Linux or Android Firmware Development Guide V2.docx
0元购版本的腾达AC9需要刷机可以用web升级的零售版本固件 firmware_ac9_v01_web.zip
Embedded Systems Firmware.pdf,一本介绍嵌入式系统编程的详细资料。
Embedded Systems Firmware Demystified 嵌入式开发初学者很好的起步教材 写自己的操作系统
D-LINK DI-624路由器 各版本 Firmware&说明书 有A B C D 四个版本的Firmware,内有 DI-624 路由器用户使用手册。
安装后打开新增的桌面的图标STM32ST-LINK Utility打开后选择ST-LINK再选择Firmware Update即可更新STlink,然后重新拔插STLINK到keil5里面就可以使用了。 具体使用方法可以参考:...
此固件只适合优硕 onepro编程器升级或者FIRMWARE损坏修复,不适合优硕其他编程器,否则刷了会损坏
PCI Firmware Specification 3.0
linux-firmware-20210208.tar.gz linux firmware 20210208版本
firmware hg8247
Rockwell Automation ControlFLASH Firmware Tool v13.04.00 刷固件工具 支持dmk
最新版I.MX6U开发板参考资料,阿尔法Linux开发板光盘资料,I.MX6ULL SDK包.zip。
dwl800ap-810固件互换,及其他版本固件
STM32 MC SDK 5.x,stm32电机库中文培训资料合集分享,包含的文件名如下: 1_An_overview_of_ST_MC_SDK_5; 2_Theoretical_basis_of_vector_control_of_ST_MC_SDK_5_x; 3_Phase_current_detection_and_...
Embedded Firmware Solutions: Development Best Practices for the Internet of Things is the perfect introduction and daily-use field guide--for the thousands of firmware designers, hardware engineers, ...