zoukankan      html  css  js  c++  java
  • Android 获取手机SIM卡运营商

    直接上代码:

    	/**
    	 * 获取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;
    	}
    

    	/**
    	 * 手机型号
    	 * 
    	 * @return
    	 */
    	public static String getPhoneModel() {
    		return android.os.Build.MODEL;
    	}
    
    	/**
    	 * 系统版本号
    	 * 
    	 * @return
    	 */
    	public static String getSystemVersion() {
    		return android.os.Build.VERSION.RELEASE;
    	}
    
    权限:
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>



  • 相关阅读:
    mysql的四种隔离
    mysql-事物
    Mysql数据备份
    线程池
    springboot整合log4j2
    springboot项目部署
    数组去重
    倒叙输出算法
    使用LLDB和debugserver对ios程序进行调试
    Linux使用pyinstaller 编译py成可执行程序
  • 原文地址:https://www.cnblogs.com/wzzkaifa/p/7135655.html
Copyright © 2011-2022 走看看