查看联系号码编程 - 机器人 [英] Get phonenumber programmatically - Android

查看:170
本文介绍了查看联系号码编程 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是有可能得到每台设备编程的联系号码? 我想这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.

这篇关于查看联系号码编程 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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