Android 获取手机SIM卡运营商
时间:2014-08-27 23:31:18
收藏:0
阅读:423
直接上代码:
/** * 获取SIM卡运营商 * * @param context * @return */ public static String getOperators(Context context) { TelephonyManager tm = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); String operator = null; String IMSI = tm.getSubscriberId(); if (IMSI == null || IMSI.equals("")) { return operator; } if (IMSI.startsWith("46000") || IMSI.startsWith("46002")) { operator = "中国移动"; } else if (IMSI.startsWith("46001")) { operator = "中国联通"; } else if (IMSI.startsWith("46003")) { operator = "中国电信"; } return operator; }
原文:http://blog.csdn.net/u010142437/article/details/38879801
评论(0)