Example usage for android.telephony TelephonyManager getSubscriberId

List of usage examples for android.telephony TelephonyManager getSubscriberId

Introduction

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

Prototype

@SuppressAutoDoc 
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public String getSubscriberId() 

Source Link

Document

Returns the unique subscriber ID, for example, the IMSI for a GSM phone.

Usage

From source file:Main.java

public static String getImsi(Context context) {
    TelephonyManager mTelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return mTelephonyMgr.getSubscriberId();
}

From source file:Main.java

public static String getIMSI(Context context) {
    TelephonyManager phone = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imsi = phone.getSubscriberId();
    return imsi == null ? "" : imsi;
}

From source file:Main.java

public static String getIMSI(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imsi = tm.getSubscriberId();
    if (imsi == null)
        imsi = "";
    return imsi;/*from w  ww.ja  v a2s  . c  o  m*/
}

From source file:Main.java

public static String getImsi() {
    TelephonyManager mTelephonyMgr = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    return mTelephonyMgr.getSubscriberId();
}

From source file:Main.java

public static String getIMSI(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return telephonyManager.getSubscriberId();
}

From source file:Main.java

public static String getIMSICode(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return telephonyManager.getSubscriberId();
}

From source file:Main.java

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

From source file:Main.java

public static String getImsi(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return telephonyManager.getSubscriberId();
}

From source file:Main.java

public static String ConfigureGetIMSI(Context context) {
    if (null == context) {
        return "";
    }/*from   w  ww. j av a  2s  .com*/
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imsi = tm.getSubscriberId();
    if (imsi == null)
        imsi = "";
    return imsi;
}

From source file:Main.java

public static String configureGetIMSI(Context context) {
    if (null == context) {
        return "";
    }/*from  w w  w  .  j  a  v  a2  s.com*/
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imsi = tm.getSubscriberId();
    if (imsi == null)
        imsi = "";
    return imsi;
}