Reputation: 199
I currently use this:
TelephonyManager telephonyManager =
(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber = telephonyManager.getLine1Number();
Which works like 85% of the time. But on some phones it returns nothing. I believe this is due to differences in Sim cards.
Is there somewhere else on the Android platform to gain this information reliably?
Thanks
Upvotes: 3
Views: 1761
Reputation: 73484
There isn't one. As far as I know, getLineNumber()
returns the Number that is shown in the About Phone screen but it doesn't always work. The api for getLineNUmber()
even says this, it returns null when the phone number isn't available.
Upvotes: 1