Get phone number in android using Java

 private String getMyPhoneNumber(){
   TelephonyManager mTelephonyMgr;
   mTelephonyMgr = (TelephonyManager)
    getSystemService(Context.TELEPHONY_SERVICE);
   return mTelephonyMgr.getLine1Number();
 }
 
 private String getMy10DigitPhoneNumber(){
  String s = getMyPhoneNumber();
  return s.substring(2);
 }

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.