Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to obtain Phone Number in Android?

Tags:

android

This is an extension to the question here. Now I quote CommonsWare

There is no reliable way to retrieve mobile number of device programatically. The only option remaining and I can think of is getting user to input for the phone number.

My question is how to check if the phone number entered by the user is correct for these and any more possibilities which I cannot think now:

  1. The number entered by the user is of the same device the app has been downloaded on.
  2. User did not make any typographical error while entering the number
  3. User did not enter any local calling code like leading 0

I have spend sufficient time on StackOverflow and web and this is not a duplicate question.

I will appreciate any help, clues or suggestions.

like image 779
Gaurav Agarwal Avatar asked May 05 '12 20:05

Gaurav Agarwal


People also ask

How do I get a phone number?

Apps That Give Out Free Phone NumbersGoogle Voice is one example, but there are many others that will give you a real phone number to make and receive internet calls. For example, you can download the FreedomPop app, the TextNow app, or the TextFree app from their respective websites.

How do I find my SIM number android?

Find My SIM Card Number on an AndroidGo to Settings > About Phone > Status, then scroll down and locate the ICCID (SIM Card) number.


1 Answers

1.The number entered by the user is of the same device the app has been downloaded on.

Again this is something kind of impossible to test, else the Tricky way mentioned by @neteinstein


2.User did not make any typographical error while entering the number

3.User did not enter any local calling code like leading 0

I think you still not aware of this library by google,used for Parsing/formatting/validating phone numbers for all countries/regions of the world.

Using that you can achive your other 2 solutions.I think.


Link : http://code.google.com/p/libphonenumber/

like image 178
MKJParekh Avatar answered Oct 30 '22 23:10

MKJParekh