How can I validate that the phone number belongs to the device?

The user just entered his phone number on my app.

How can I verify that the phone number belongs to the mobile device at hand and not, lets say, one that his partner-in-crime holds right next to him?

Not sure I fully understand the use case.

What about:

  • generate a code as random number in app
  • send a message to the phone number with this generated code number
  • ask user to tap the number in app, within let's say 2 minutes
  • if OK, continue
  • if fails or timeout, quit the app.

If the question really is: “is there an API to get the phone number of the current device?” then the answer is: no there isn’t, because that would be a massive privacy fail.

How can I validate that the phone number belongs to the device?
 
 
Q