is it possible to get the phonenumber of each device programmatically? I tried this code:
TelephonyManager manager =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
mPhoneNumber = manager.getLine1Number();
This works fine with some providers. Unfortunately it does not work with each provider. So i am looking for a trick or work around to get the phonenumber of the device. Is there a solution or is it impossible because the number is not stored on the sim card?
On Android the most common path to finding your number is: Settings > About phone/device > Status/phone identity > Network. This slightly differs on Apple devices, where you can follow the path of Settings > Phone > My Number.
Swipe up or down to view the apps. Touch Settings. Scroll to and touch About phone. Scroll to My phone number, your phone number is displayed.
The method you are using is the only one part of the SDK to do this, and only works on devices where the number is stored on the SIM card, which only some carriers do. For all other carriers, you will have to ask the user to enter the phone number manually, as the number is simply not stored anywhere on the device from where you can retrieve it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With