To pre-fill a phone-number field in our application we'd like to use the SIM-stored phone number (when available). For this we used the common solution also outlined in this popular question/answer:
TelephonyManager tMgr = (TelephonyManager) mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
String mPhoneNumber = tMgr.getLine1Number();
The issue with this, however, is that this string will also contain the international dialing prefix, i.e. will look something like this:
'+[prefix][phoneNumber]'
As the prefix
varies between 1 and 3 digits, it's we can't simply trim it...
--> Is there a way to get to the phone number from the SIM without the country dialing prefix?