I have read that using getLine1Number() as in the code below can have problems such as
- returning null
- returning an invalid string
- cause nullPointer exception.
Is there any other problems that it can cause?
The biggest issue, which I am not sure of, is, does it return an invalid number (like the number the phone had before) ? This is the most important problem since if it returns a number, can I depend on that number?
Code:
TelephonyManager tMgr = (TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
String mPhoneNumber = tMgr.getLine1Number();
Required Permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>