0

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.

Kamalone
  • 4,045
  • 5
  • 40
  • 64

2 Answers2

1

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

Anirudh
  • 2,767
  • 5
  • 69
  • 119
0
  1. Did you set permissions in Manifest READ_PHONE_STATE ?
  2. Method still can return null

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

peter_budo
  • 1,748
  • 4
  • 26
  • 48