public void setDefault() {
        try {
            TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
            String phone = telephonyManager.getLine1Number();
            if (phone != null && !phone.isEmpty()) {
                this.setNumber(phone);
            } else {
                String iso = telephonyManager.getNetworkCountryIso();
                setEmptyDefault(iso);
            }
        } catch (SecurityException e) {
            setEmptyDefault();
        }
    }
public void setDefault ( ) { try { TelephonyManager telephonyManager = ( TelephonyManager ) getContext ( ) . getSystemService ( Context . TELEPHONY_SERVICE ) ; String phone = telephonyManager . getLine1Number ( ) ; if ( phone != null && ! phone . isEmpty ( ) ) { this . setNumber ( phone ) ; } else { String iso = telephonyManager . getNetworkCountryIso ( ) ; setEmptyDefault ( iso ) ; } } catch ( SecurityException e ) { setEmptyDefault ( ) ; } }
Set default value
Will try to retrieve phone number from device