检索移动电话的号码和IMEI [英] Retrieve the number and IMEI of the mobile phone

查看:152
本文介绍了检索移动电话的号码和IMEI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要找回自己的手机号和IMEI。

I want to retrieve the own mobile number and the IMEI.

我如何从Android手机这些信息?

How do I get this information from the Android phone?

推荐答案

使用

TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// get IMEI
String imei = tm.getDeviceId();
String phone = tm.getLine1Number();

但它不是对例如非手机设备总是可靠的。您还需要添加permisionandroid.permission.READ_PHONE_STATE。

but its not always reliable on for example non phone device. You will also need to add permision "android.permission.READ_PHONE_STATE".

这篇关于检索移动电话的号码和IMEI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆