标签:android
获取手机设备型号等信息:
如图华为P6手机获取是手机设备信息值:
代码如下:
tvStr = (TextView) findViewById(R.id.tv_titlebar); String phoneInfo = "Product: " + android.os.Build.PRODUCT + "\n"; phoneInfo += "CPU_ABI: " + android.os.Build.CPU_ABI + "\n"; phoneInfo += "TAGS: " + android.os.Build.TAGS + "\n"; phoneInfo += "VERSION_CODES.BASE: " + android.os.Build.VERSION_CODES.BASE + "\n"; phoneInfo += "MODEL: " + android.os.Build.MODEL + "\n"; phoneInfo += "SDK: " + android.os.Build.VERSION.SDK + "\n"; phoneInfo += "VERSION.RELEASE: " + android.os.Build.VERSION.RELEASE + "\n"; phoneInfo += "DEVICE: " + android.os.Build.DEVICE + "\n"; phoneInfo += "DISPLAY: " + android.os.Build.DISPLAY + "\n"; phoneInfo += "BRAND: " + android.os.Build.BRAND + "\n"; phoneInfo += "BOARD: " + android.os.Build.BOARD + "\n"; phoneInfo += "FINGERPRINT: " + android.os.Build.FINGERPRINT + "\n"; phoneInfo += "ID: " + android.os.Build.ID + "\n"; phoneInfo += "MANUFACTURER: " + android.os.Build.MANUFACTURER + "\n"; phoneInfo += "USER: " + android.os.Build.USER + "\n"; // 这种方式在service中无法使用, DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; // 宽 int height = dm.heightPixels; // 高 //在service中也能得到高和宽 // WindowManager mWindowManager = (WindowManager) // getSystemService(Context.WINDOW_SERVICE); // width = mWindowManager.getDefaultDisplay().getWidth(); // height = mWindowManager.getDefaultDisplay().getHeight(); phoneInfo += "width: " + width + "\n"; phoneInfo += "height: " + height; tvStr.setText(phoneInfo);
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:android
原文地址:http://blog.csdn.net/u012440207/article/details/48001209