import android.telephony.TelephonyManager;
public static final String CHINA_MOBILE = "cm";// 移动
public static final String CHINA_UNICOM = "cu";// 联通
public static final String CHINA_TELCOM = "ct";// 电信
public static final String CHINA_OTHER = "other";// 其它
public static synchronized String getSIMOperator(Context context){
String strOperator = "";
TelephonyManager tempTelephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
int status = tempTelephonyManager.getSimState();
if((status == TelephonyManager.SIM_STATE_UNKNOWN) || (status == TelephonyManager.SIM_STATE_ABSENT)){
return CHINA_OTHER;
}
String strOperator = tempTelephonyManager.getSimOperator().trim();
if(strOperator.endsWith("00") || strOperator.endsWith("02") || strOperator.endsWith("07")){
return CHINA_MOBILE;
}else if(strOperator.endsWith("01")){
return CHINA_UNICOM;
}else if(strOperator.endsWith("03") || strOperator.endsWith("99") || strOperator.endsWith("20404")){
return CHINA_TELCOM;
}
return CHINA_OTHER;
}