Example usage for android.telephony TelephonyManager getSimOperator

List of usage examples for android.telephony TelephonyManager getSimOperator

Introduction

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

Prototype

public String getSimOperator() 

Source Link

Document

Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM.

Usage

From source file:Main.java

private static boolean isOperator(TelephonyManager telephonyManager, String operator) {
    String simOperator = telephonyManager.getSimOperator();
    return simOperator != null && simOperator.equals(operator);
}

From source file:Main.java

@Deprecated
public static boolean isCMCCSimCard(Context context) {
    TelephonyManager teleManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return teleManager.getSimOperator().equals("46000");
}

From source file:Main.java

public static boolean isChinaUnicom(final Context context) {
    final TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    final String operator = telManager.getSimOperator();
    return "46001".equals(operator);
}

From source file:Main.java

private static String getOperators(Context context) {
    TelephonyManager tel = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tel == null ? "" : tel.getSimOperator();
}

From source file:Main.java

public static String[] getSimOperatorCodes(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String simOperator = telephonyManager.getSimOperator();
    String[] mccmnc = new String[] { null, null };
    if (!TextUtils.isEmpty(simOperator)) {
        mccmnc[0] = simOperator.substring(0, 3);
        mccmnc[1] = simOperator.substring(3);
    }/* w  w  w .  j a v  a 2 s . co  m*/
    return mccmnc;
}

From source file:Main.java

public static String getOperater(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm == null || 5 != tm.getSimState()) {
        return "";
    }// w w  w .  j av  a 2 s .com
    return tm.getSimOperator();
}

From source file:Main.java

public static String getMNC(Context ctx) {
    String providersName = "";
    TelephonyManager telephonyManager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
    if (telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY) {
        providersName = telephonyManager.getSimOperator();
        providersName = providersName == null ? "" : providersName;
    }/*from  w ww .  j a v a 2 s  .c  o m*/
    return providersName;
}

From source file:Main.java

public static String queryDevicePhone(Context context) {
    TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (manager != null) {
        operatorCode = manager.getNetworkOperator();
        if (operatorCode == null || operatorCode.length() == 0)
            operatorCode = manager.getSimOperator();
        isoCountryCode = manager.getNetworkCountryIso();
        if (isoCountryCode == null || isoCountryCode.length() == 0)
            isoCountryCode = manager.getSimCountryIso();
        if (isoCountryCode == null || isoCountryCode.length() == 0)
            isoCountryCode = context.getResources().getConfiguration().locale.getCountry();
    }//from  ww w  . ja  va 2 s  .  co  m
    return manager.getLine1Number();
}

From source file:Main.java

public static String getPhoneStatus(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String str = "";
    str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n";
    str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n";
    str += "Line1Number = " + tm.getLine1Number() + "\n";
    str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n";
    str += "NetworkOperator = " + tm.getNetworkOperator() + "\n";
    str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n";
    str += "NetworkType = " + tm.getNetworkType() + "\n";
    str += "honeType = " + tm.getPhoneType() + "\n";
    str += "SimCountryIso = " + tm.getSimCountryIso() + "\n";
    str += "SimOperator = " + tm.getSimOperator() + "\n";
    str += "SimOperatorName = " + tm.getSimOperatorName() + "\n";
    str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n";
    str += "SimState = " + tm.getSimState() + "\n";
    str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";
    str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n";
    return str;//ww w .ja  v  a 2s.  c  o  m
}

From source file:Main.java

public static String getDeviceInfo(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    StringBuilder sb = new StringBuilder();
    sb.append("\nDeviceId(IMEI) = " + tm.getDeviceId());
    sb.append("\nDeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion());
    sb.append("\nLine1Number = " + tm.getLine1Number());
    sb.append("\nNetworkCountryIso = " + tm.getNetworkCountryIso());
    sb.append("\nNetworkOperator = " + tm.getNetworkOperator());
    sb.append("\nNetworkOperatorName = " + tm.getNetworkOperatorName());
    sb.append("\nNetworkType = " + tm.getNetworkType());
    sb.append("\nPhoneType = " + tm.getPhoneType());
    sb.append("\nSimCountryIso = " + tm.getSimCountryIso());
    sb.append("\nSimOperator = " + tm.getSimOperator());
    sb.append("\nSimOperatorName = " + tm.getSimOperatorName());
    sb.append("\nSimSerialNumber = " + tm.getSimSerialNumber());
    sb.append("\nSimState = " + tm.getSimState());
    sb.append("\nSubscriberId(IMSI) = " + tm.getSubscriberId());
    sb.append("\nVoiceMailNumber = " + tm.getVoiceMailNumber());

    return sb.toString();
}