Search code examples
androidtelephonymanager

Verifying the phone number


In my application first thing the user should do is the registration. For that i need the phone no. So the user will give their 10 digit number. Now i need to verfy the user inputed the same number which holds by the phone. How to do that ? i tried .getLine1Number() but it is returing nothing.

After pressing the register button i am calling a url which will send a verification code to the phone number was inputed by the user. Till that i am showing a alert dialog. After receiving the message only i am dismissing the dialoge box.

So the problem happens when the user give a valid number which may not their number.

PS: I need to get the response through message only.


Solution

  • Only few service providers provide phone number via getLine1Number() method. Instead you can get a unique number for each sim using getSimSerialNumber() method.