当前位置: 首页>>代码示例>>Java>>正文


Java TelephonyManager.getSimOperator方法代码示例

本文整理汇总了Java中android.telephony.TelephonyManager.getSimOperator方法的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.getSimOperator方法的具体用法?Java TelephonyManager.getSimOperator怎么用?Java TelephonyManager.getSimOperator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.telephony.TelephonyManager的用法示例。


在下文中一共展示了TelephonyManager.getSimOperator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSimOperatorByMnc

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取Sim卡运营商名称
 * <p>中国移动、如中国联通、中国电信</p>
 *
 * @return 移动网络运营商名称
 */
public static String getSimOperatorByMnc() {
    TelephonyManager tm = (TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE);
    String operator = tm != null ? tm.getSimOperator() : null;
    if (operator == null) return null;
    switch (operator) {
        case "46000":
        case "46002":
        case "46007":
            return "中国移动";
        case "46001":
            return "中国联通";
        case "46003":
            return "中国电信";
        default:
            return operator;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:PhoneUtils.java

示例2: getPhoneStatus

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取手机状态信息
 * <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
 *
 * @return DeviceId(IMEI) = 99000311726612<br>
 * DeviceSoftwareVersion = 00<br>
 * Line1Number =<br>
 * NetworkCountryIso = cn<br>
 * NetworkOperator = 46003<br>
 * NetworkOperatorName = 中国电信<br>
 * NetworkType = 6<br>
 * honeType = 2<br>
 * SimCountryIso = cn<br>
 * SimOperator = 46003<br>
 * SimOperatorName = 中国电信<br>
 * SimSerialNumber = 89860315045710604022<br>
 * SimState = 5<br>
 * SubscriberId(IMSI) = 460030419724900<br>
 * VoiceMailNumber = *86<br>
 */
@SuppressLint("HardwareIds")
public static String getPhoneStatus() {
    TelephonyManager tm = (TelephonyManager) Utils.getApp()
            .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 += "PhoneType = " + 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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:PhoneUtils.java

示例3: getMccMnc

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String getMccMnc(final Context context) {
  final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
  final int configMcc = context.getResources().getConfiguration().mcc;
  final int configMnc = context.getResources().getConfiguration().mnc;
  if (tm.getSimState() == TelephonyManager.SIM_STATE_READY) {
    Log.w(TAG, "Choosing MCC+MNC info from TelephonyManager.getSimOperator()");
    return tm.getSimOperator();
  } else if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
    Log.w(TAG, "Choosing MCC+MNC info from TelephonyManager.getNetworkOperator()");
    return tm.getNetworkOperator();
  } else if (configMcc != 0 && configMnc != 0) {
    Log.w(TAG, "Choosing MCC+MNC info from current context's Configuration");
    return String.format("%03d%d",
        configMcc,
        configMnc == Configuration.MNC_ZERO ? 0 : configMnc);
  } else {
    return null;
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:20,代码来源:TelephonyUtil.java

示例4: getSimOperatorByMnc

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取Sim卡运营商名称
 * <p>中国移动、如中国联通、中国电信</p>
 *
 * @return 移动网络运营商名称
 */
public static String getSimOperatorByMnc() {
    TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
    String operator = tm != null ? tm.getSimOperator() : null;
    if (operator == null) return null;
    switch (operator) {
        case "46000":
        case "46002":
        case "46007":
            return "中国移动";
        case "46001":
            return "中国联通";
        case "46003":
            return "中国电信";
        default:
            return operator;
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:24,代码来源:PhoneUtils.java

示例5: getOperatorName

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取运行商名称
 *
 * @param context
 * @return 运营商名称
 */
private static String getOperatorName(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String operator = telephonyManager.getSimOperator();
    String operatorName = "";
    if (operator != null) {
        if (operator.equals("46000") || operator.equals("46002")) {
            operatorName = "移动";
        } else if (operator.equals("46001")) {
            operatorName = "联通";
        } else if (operator.equals("46003")) {
            operatorName = "电信";
        }
    }
    return operatorName;
}
 
开发者ID:xiarunhao123,项目名称:Ency,代码行数:22,代码来源:AppNetWorkUtil.java

示例6: getPhoneStatus

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取手机状态信息
 * <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
 *
 * @return DeviceId(IMEI) = 99000311726612<br>
 * DeviceSoftwareVersion = 00<br>
 * Line1Number =<br>
 * NetworkCountryIso = cn<br>
 * NetworkOperator = 46003<br>
 * NetworkOperatorName = 中国电信<br>
 * NetworkType = 6<br>
 * honeType = 2<br>
 * SimCountryIso = cn<br>
 * SimOperator = 46003<br>
 * SimOperatorName = 中国电信<br>
 * SimSerialNumber = 89860315045710604022<br>
 * SimState = 5<br>
 * SubscriberId(IMSI) = 460030419724900<br>
 * VoiceMailNumber = *86<br>
 */
public static String getPhoneStatus() {
    TelephonyManager tm = (TelephonyManager) Utils.getContext()
            .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;
}
 
开发者ID:tututututututu,项目名称:BaseCore,代码行数:42,代码来源:PhoneUtils.java

示例7: getPhoneStatus

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取手机状态信息
 * <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
 *
 * @return DeviceId(IMEI) = 99000311726612<br>
 * DeviceSoftwareVersion = 00<br>
 * Line1Number =<br>
 * NetworkCountryIso = cn<br>
 * NetworkOperator = 46003<br>
 * NetworkOperatorName = 中国电信<br>
 * NetworkType = 6<br>
 * honeType = 2<br>
 * SimCountryIso = cn<br>
 * SimOperator = 46003<br>
 * SimOperatorName = 中国电信<br>
 * SimSerialNumber = 89860315045710604022<br>
 * SimState = 5<br>
 * SubscriberId(IMSI) = 460030419724900<br>
 * VoiceMailNumber = *86<br>
 */
@SuppressLint("HardwareIds")
public static String getPhoneStatus() {
    TelephonyManager tm = (TelephonyManager) Utils.getContext()
            .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 += "PhoneType = " + 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;
}
 
开发者ID:pan2yong22,项目名称:AndroidUtilCode-master,代码行数:43,代码来源:PhoneUtils.java

示例8: getSimOperatorByMnc

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取 Sim 卡运营商名称
 * <p>中国移动、如中国联通、中国电信</p>
 *
 * @return 移动网络运营商名称
 */
public static String getSimOperatorByMnc(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String operator = tm != null ? tm.getSimOperator() : null;
    if (operator == null) return null;
    switch (operator) {
        case "46000":
        case "46002":
        case "46007":
            return "中国移动";
        case "46001":
            return "中国联通";
        case "46003":
            return "中国电信";
        default:
            return operator;
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:24,代码来源:PhoneManager.java

示例9: getPhoneStatus

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取手机状态信息
 * <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
 *
 * @return DeviceId(IMEI) = 99000311726612<br>
 * DeviceSoftwareVersion = 00<br>
 * Line1Number =<br>
 * NetworkCountryIso = cn<br>
 * NetworkOperator = 46003<br>
 * NetworkOperatorName = 中国电信<br>
 * NetworkType = 6<br>
 * honeType = 2<br>
 * SimCountryIso = cn<br>
 * SimOperator = 46003<br>
 * SimOperatorName = 中国电信<br>
 * SimSerialNumber = 89860315045710604022<br>
 * SimState = 5<br>
 * SubscriberId(IMSI) = 460030419724900<br>
 * VoiceMailNumber = *86<br>
 */
@SuppressLint("HardwareIds")
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 += "PhoneType = " + 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;
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:43,代码来源:PhoneManager.java

示例10: getOperator

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static int getOperator() {
    Context context = BaseApplication.getInstance().getApplicationContext();
    NetworkInfo networkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
    String imsi = "";
    if (networkInfo != null && networkInfo.isAvailable()) {
        TelephonyManager tm = (TelephonyManager) context.getSystemService("phone");
        imsi = tm.getSimOperator();
        if (TextUtils.isEmpty(imsi)) {
            imsi = tm.getSubscriberId();
        }
    }
    if (TextUtils.isEmpty(imsi)) {
        return 0;
    }
    return getOperatorByNetworkNumber(imsi);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:NetworkUtils.java

示例11: m

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String m(Context context) {
    try {
        if (!a(context, "android.permission.READ_PHONE_STATE")) {
            f.e((Object) "Could not get permission of android.permission.READ_PHONE_STATE");
            return null;
        } else if (!o(context)) {
            return null;
        } else {
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService
                    ("phone");
            return telephonyManager != null ? telephonyManager.getSimOperator() : null;
        }
    } catch (Object th) {
        f.e(th);
        return null;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:k.java

示例12: a

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
private static String a(TelephonyManager telephonyManager) {
    String simOperator = telephonyManager.getSimOperator();
    if ("46000".equals(simOperator) || "46002".equals(simOperator) || "46007".equals
            (simOperator)) {
        return "1";
    }
    if ("46001".equals(simOperator) || "46006".equals(simOperator)) {
        return "2";
    }
    if ("46003".equals(simOperator) || "46005".equals(simOperator)) {
        return "3";
    }
    if ("46020".equals(simOperator)) {
        return "4";
    }
    return "0";
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:DeviceInfoUtils.java

示例13: getMCC

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
private String getMCC() {
	TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
	// 返回当前手机注册的网络运营商所在国家的MCC+MNC. 如果没注册到网络就为空.
	String networkOperator = tm.getNetworkOperator();
	if (!TextUtils.isEmpty(networkOperator)) {
		return networkOperator;
	}

	// 返回SIM卡运营商所在国家的MCC+MNC. 5位或6位. 如果没有SIM卡返回空
	return tm.getSimOperator();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:RegisterPage.java

示例14: getMNC

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
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;
    }
    return providersName;
}
 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:10,代码来源:DeviceUtils.java

示例15: getSimOperator

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String getSimOperator(Context context) {
	TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
	if(tm != null){
		return tm.getSimOperator();
	}
	return null;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:8,代码来源:NetworkUtil.java


注:本文中的android.telephony.TelephonyManager.getSimOperator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。