List of utility methods to do Phone Number Get
String | getPhoneNumber(Context context) get Phone Number TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getLine1Number();
|
String | getPlainPhoneNumber(String phoneNumber) Convert a formatted phone number into a plain digit-only phonumber if (phoneNumber == null || phoneNumber.isEmpty()) return ""; String newPhoneNumber = new String(phoneNumber); newPhoneNumber = newPhoneNumber.replace(" ", ""); newPhoneNumber = newPhoneNumber.replace("(", ""); newPhoneNumber = newPhoneNumber.replace("-", ""); newPhoneNumber = newPhoneNumber.replace(")", ""); newPhoneNumber = newPhoneNumber.replace("+", ""); ... |
String | getMy10DigitPhoneNumber(Context ctx) get My Digit Phone Number try { String s = getMyPhoneNumber(ctx); return s.substring(2); } catch (Exception e) { return ""; |
String | getMyPhoneNumber(Context ctx) get My Phone Number try { TelephonyManager mTelephonyMgr; mTelephonyMgr = (TelephonyManager) ctx .getSystemService(Context.TELEPHONY_SERVICE); return mTelephonyMgr.getLine1Number(); } catch (Exception e) { return ""; |
String | getPhoneNumber(int contactId) This method used to get phone number from contact id. String phoneNumber = ""; final String[] projection = new String[] { Phone.NUMBER, Phone.TYPE, }; final Cursor phone = mSmartAndroidActivity.managedQuery( Phone.CONTENT_URI, projection, Data.CONTACT_ID + "=?", new String[] { String.valueOf(contactId) }, null); if (phone.moveToFirst()) { final int contactNumberColumnIndex = phone ... |