无法在Android 2.2获取手机号码 [英] Unable to fetch Mobile number on Android 2.2

查看:90
本文介绍了无法在Android 2.2获取手机号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了标准的code以下到Android 2.2 GSM设备上获取手机号码,但我总是得到一个空字符串。是此功能支持2.2?
任何建议,我怎么可以获取在Android 2.2设备中的手机号码。

 私人字符串getMyPhoneNumber(){
    TelephonyManager mTelephonyMgr;
    mTelephonyMgr =(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    返回mTelephonyMgr.getLine1Number();
}


解决方案

进入设置 - >关于手机 - >状态 - >看到我的电话号码字段。如果说,未知,那么这不是你的问题,它只是一个事实,即一些运营商不与自己的号码打包的SIM卡。在某些设备上的用户可以编辑自己的号码,但它并不总是由固件支持。

这里

I have used the standard code below to fetch the mobile number on my ANDROID 2.2 GSM device, BUT I ALWAYS GET AN EMPTY STRING. Is this feature supported on 2.2? Any suggestion as to how I can fetch the mobile number on Android 2.2 device.

private String getMyPhoneNumber(){
    TelephonyManager mTelephonyMgr;
    mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 
    return mTelephonyMgr.getLine1Number();
}

解决方案

Go to Settings -> About phone -> Status -> see at My Phone Number field. If it says "Unknown" then it's not your issue, it's just the fact that some carriers don't pack the SIM cards with own number. On some devices user can edit own number, but it's not always supported by the firmware.

Read here

这篇关于无法在Android 2.2获取手机号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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