Reputation: 272
I've got a SIM card where android itself is showing unknown as the telephone number.
Therefore also getLine1Number()
returns an empty string
.
However, WhatsApp is able to read my telephone number perfectly.
I'm wondering how it works (technically).
Does anyone have an idea?
Upvotes: 2
Views: 5434
Reputation: 19214
Retrieving phone number is not always possible and permitted. Most mobile operators lock this feature in their handsets.
WhatsApp ask for phone number and saves it
You can send an SMS to a server and save it, if user permits.
Upvotes: 2
Reputation: 1942
It doesn't. It's not possible for an app to get the phone number. Whatsapp asks for the number manually and it sends you a verification code by sms.
Upvotes: 2
Reputation: 2137
A solution would be to find the most common phone number in received SMS.
WhatsApp has the permission to do that.
Upvotes: 1