安卓客户端获取手机号码代码实例
//创建电话管理
TelephonyManager tm = (TelephonyManager)
//与手机建立连接
getSystemService(Context.TELEPHONY_SERVICE);
//获取手机号码
String phoneNo=tm.getLine1Number();
// 返回唯一的用户ID;就是这张卡的编号神马的
IMSI = telephonyManager.getSubscriberId();
// IMSI号前面3位460是国家,紧接着后面2位00 02是中国移动,01是中国联通,03是中国电信。
<!-- 添加权限 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />