Getting reliable MSISDN from Android Phone? VoiceMailNumber Line1Number [duplicate]

纵饮孤独 提交于 2019-12-02 05:13:38

It wont be 100% reliable if you use getVoiceMailNumber(). A lot of times this may give the phone number but what if the handset gets a firmware update and this number changes to something else? say a short code? So no, it is not reliable.

If you can get the number from getLine1Number() then why dont you prompt user to enter the number? You can verify it by sending that number an SMS message with a short code, which the user will be required to enter in the app before proceeding further.

This is an old question. However, I would like to share some information which may help people in the future:

getLine1Number() Returns the phone number string for line 1, for example, the MSISDN for a GSM phone. Return null if it is unavailable.

MSISDN is the phone number. However, MSISDN is stored in a file in the SIMCard. Main problem is that it is not mandatory to fill that file. So, you have some simcards which includes MSISDN while other simcards does not have that information.

So, read the MSISDN is totally NOT reliable.

getVoiceMailNumber() Returns the voice mail number. Return null if it is unavailable.

This is also not reliable since this number changes from carrier to carrier. Some carrier uses as voice mail your own phone number. However, some other carriers uses a different number like *55 or something like that.

So, it is very difficult to determine your own phone number. So, avoid to use phone number.

another way of going through it is to make the user input their number. then send an SMS to this number entered.

validate that this message has been received, then u can categorically say that the user has entered the correct MSISDN and you store this.

simples :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!