zoukankan      html  css  js  c++  java
  • android获取手机机型、厂商、deviceID基本信息

    /**
     * 系统工具类
     */
    public class SystemUtil {
    
        /**
         * 获取当前手机系统语言。
         *
         * @return 返回当前系统语言。例如:当前设置的是“中文-中国”,则返回“zh-CN”
         */
        public static String getSystemLanguage() {
            return Locale.getDefault().getLanguage();
        }
    
        /**
         * 获取当前系统上的语言列表(Locale列表)
         *
         * @return  语言列表
         */
        public static Locale[] getSystemLanguageList() {
            return Locale.getAvailableLocales();
        }
    
        /**
         * 获取当前手机系统版本号
         *
         * @return  系统版本号
         */
        public static String getSystemVersion() {
            return android.os.Build.VERSION.RELEASE;
        }
    
        /**
         * 获取手机型号
         *
         * @return  手机型号
         */
        public static String getSystemModel() {
            return android.os.Build.MODEL;
        }
    
        /**
         * 获取手机厂商
         *
         * @return  手机厂商
         */
        public static String getDeviceBrand() {
            return android.os.Build.BRAND;
        }
    
        /**
         * 获取手机IMEI(需要“android.permission.READ_PHONE_STATE”权限)
         *
         * @return  手机IMEI
         */
        public static String getIMEI(Context ctx) {
            TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Activity.TELEPHONY_SERVICE);
            if (tm != null) {
                return tm.getDeviceId();
            }
            return null;
        }
    }
  • 相关阅读:
    shell基础知识8-xargs命令
    shell基础知识7-字段分隔符与迭代器
    shell基础知识6-在不按回车键的情况下读入N个字符
    DevOps
    DevOps
    Jenkins
    Jenkins
    Jenkins
    Jenkins
    Gerrit
  • 原文地址:https://www.cnblogs.com/bimingcong/p/7465334.html
Copyright © 2011-2022 走看看