查看联系号码编程 - 机器人机器人、号码

2023-09-12 21:38:14 作者:帅哥协会会长

是有可能得到每台设备编程的联系号码? 我想这code:

is it possible to get the phonenumber of each device programmatically? I tried this code:

TelephonyManager manager =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
mPhoneNumber = manager.getLine1Number();

这正常工作与一些供应商。不幸的是它不与每个提供工作。所以我要寻找一个恶作剧还是解决获取设备的联系号码。有溶液或它是不可能的,因为号没有存储在SIM卡上?

This works fine with some providers. Unfortunately it does not work with each provider. So i am looking for a trick or work around to get the phonenumber of the device. Is there a solution or is it impossible because the number is not stored on the sim card?

推荐答案

您正在使用的方法是只是其中的一部分的SDK做到这一点,并且仅适用于其中的数字存储在SIM卡上的设备,这只有某些运营商。对于所有其他运营商,则必须要求用户手动输入电话号码,该号码根本不存储在设备上,从那里你可以检索它。

The method you are using is the only one part of the SDK to do this, and only works on devices where the number is stored on the SIM card, which only some carriers do. For all other carriers, you will have to ask the user to enter the phone number manually, as the number is simply not stored anywhere on the device from where you can retrieve it.