In this tutorial you will learn how to detect your own phone number programmatically
Step: add permission to Android Manifest
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
</manifest>
Step: use TelephonyManager to read the number
private String getMyPhoneNumber() {
TelephonyManager manager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE);
String myPhoneNumber = manager.getLine1Number();
return myPhoneNumber;
}