Android 通过Builder获取硬件信息

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_29856589/article/details/79981433
package supportquicknews.ypz.com.blogproject.java.hardwareInformation;

import android.content.Context;
import android.os.Build;

/**
 * Created by kingadmin on 2018/4/17.
 */

public class HardwareInformationUtil {

    private static HardwareInformationUtil hardwareInformationUtil;
    private Context context;

    private HardwareInformationUtil(Context context) {
        this.context = context;
    }

    public static HardwareInformationUtil getHardwareInformationUtil(Context context) {
        if (hardwareInformationUtil == null) {
            synchronized (HardwareInformationUtil.class) {
                hardwareInformationUtil = new HardwareInformationUtil(context);
            }
        }
        return hardwareInformationUtil;
    }

    /**
     * 获取主板名字
     * */
    public String getBoradName() {
        return Build.BOARD;
    }

    /**
     * 获取主板版本号
     * */
    public String getPhoneInfo(){
        return Build.BOOTLOADER;
    }

    /**
     * 获取手机出厂商品牌
     * */
    public String getBrand(){return Build.BRAND;}

    /**
     * 获取Cpu指令集1
     * */
    public String getCpuAbi1(){return Build.CPU_ABI;}
    /**
     * 获取Cpu指令集2
     * */
    public String getCpuAbi2(){return Build.CPU_ABI2;}

    /**
     * 获取当前手机SDK
     * */
    public int getSDKVersion(){return Build.VERSION.SDK_INT;}

    /**
     * 获取手机系统版本
     * */
    public  String getSystemVersion(){return Build.VERSION.RELEASE;}

    /**
     * 获取设备显示的版本
     * */
    public String getDisplay(){return Build.DISPLAY;}

    /**
     * 获取手机型号名称
     * */
    public String getPhoneVersionName(){return Build.PRODUCT;}

    /**
     * 获取制造商
     * */
    public String getManufacturer(){ return Build.MANUFACTURER;}

    /**
     * 获取驱动名
     * */
    public String getDeviceName(){ return Build.DEVICE;}

    /**
     * 获取设备唯一标识符
     * */
    public String getFingerprint(){return Build.FINGERPRINT;}

    /**
     * 获取串口序列号
     * */
    public String getSerial(){return Build.SERIAL;}

    /**
     * 获取主机地址
     * */
    public String getHost(){return Build.HOST;}

    /**
     * 获取系统当前开发版本号
     * */
    public String getCodeName(){return Build.ID;}
}

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页