How can I programmatically get the phone number of the device that is running my android app?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Code:
Required Permission:
Caveats:
According to the highly upvoted comments, there are a few caveats to be aware of. This can return
nullor""or even"???????", and it can return a stale phone number that is no longer valid. If you want something that uniquely identifies the device, you should usegetDeviceId()instead.