Ogulcan Orhan
Ogulcan Orhan

Reputation: 5317

TelephonyManager is not Providing Phone Number on Every Device

I need phone numbers while developing my application. So, I used TelephonyManager as seen below:

TelephonyManager tmgr =(TelephonyManager)getApplicationContext().getSystemService(getApplicationContext().TELEPHONY_SERVICE);
Log.d("Tag", tmgr.getLine1Number());

But when I tried application in different devices, somehow getLine1Number() not working. I mean returns NULL.

Permission is okay. Finally, does getLine1Number() depend on other requirements? Is it possible to learn phone number on every device.

Thanks for advices.

Upvotes: 1

Views: 2453

Answers (1)

Buda Gavril
Buda Gavril

Reputation: 21657

it is not possible to get phone number on every device because this depends on how sim card is made. This is a sim card limitation.

Upvotes: 4

Related Questions