-1

I want to obtain mobile number from device for registration page. I used TelephonyManager but its not working in all devices and I also used GoogleApiClient with HintRequest in this service open dialogbox to select mobile number but its looking weird, so please suggest me a better option which is supported all android devices

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • 1
    There is no way which is supported in all Android devices. – CommonsWare Dec 15 '18 at 15:03
  • Please don't Write with Random Upper case Letters because It's Harder to Read. That's not how you write English. – James Z Dec 15 '18 at 16:45
  • @CommonsWare ok, thanks – NITIN CHAUDHARY Dec 16 '18 at 03:18
  • This question has been asked about a hundred times. I've closed this as duplicate. Please see the linked question and read the answers and comments. Generally speaking, the answer is: "you cannot reliably get the number". Calling `TelefonyManager.getLine1Number()` will return the phone number which is written on the SIM card. This may be the user's number, it may be null and it is possible that the user has changed his number and this is his old number. – David Wasser Dec 21 '18 at 14:52

1 Answers1

1

I think the easiest way is to ask user to manually type his own phone number. Telephony permission looks dangerous and you can face issues with releasing to google play store.

Typically, you may also need to intercept incoming sms messages

Lukas
  • 1,216
  • 12
  • 25