Example usage for android.telephony TelephonyManager getLine1Number

List of usage examples for android.telephony TelephonyManager getLine1Number

Introduction

In this page you can find the example usage for android.telephony TelephonyManager getLine1Number.

Prototype

@SuppressAutoDoc 
@RequiresPermission(anyOf = { android.Manifest.permission.READ_PHONE_STATE,
        android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS })
public String getLine1Number() 

Source Link

Document

Returns the phone number string for line 1, for example, the MSISDN for a GSM phone.

Usage

From source file:Main.java

public static String getMSISDN(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getLine1Number();
}

From source file:Main.java

public static String getLine1Number(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getLine1Number();
}

From source file:Main.java

public static String getPhoneNumber(Context context) {
    TelephonyManager tMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tMgr.getLine1Number();
}

From source file:Main.java

public static String getPhoneNumber(Context context) {
    TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return manager.getLine1Number();
}

From source file:Main.java

public static String getPhoneNumber(Context context) {
    TelephonyManager phoneMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return phoneMgr.getLine1Number();
}

From source file:Main.java

public static String getPhoneNumber(Context context) {
    TelephonyManager teleMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return teleMgr.getLine1Number();
}

From source file:Main.java

public static String getLinePhone(Context context) {
    TelephonyManager phoneMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return phoneMgr.getLine1Number();
}

From source file:Main.java

/**
 * Return the mobile number./*from   w w w. j ava2s.  c  o  m*/
 *
 * @param context
 * @return
 */
public static String getMobileNumber(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getLine1Number();
}

From source file:Main.java

static String queryDevicePhone(Context context) {
    TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    return manager.getLine1Number();
}

From source file:Main.java

public static String getMobileNumber(Context context) {
    TelephonyManager t = (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE);
    String number = t.getLine1Number();
    return number;
}