Android获取设备相关信息
1、获取设备宽度(px):
context.getResources().getDisplayMetrics().widthPixels;

2、获取设备高度(px):爷愁
context.getResources().getDisplayMetrics().heightPixels;

3、SD卡判断:
Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);

4、是否有网络:
if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mNetworkInfo = mConnectivityManager .getActiveNetworkInfo(); if (mNetworkInfo != null) { return mNetworkInfo.isAvailable(); } } return false;

5、获取设备的唯一标识,deviceId:
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String deviceId = tm.getDeviceId(); if (deviceId == null) { return -; } else { 屈随 return deviceId; }

6、获取手机品牌:
android.os.Build.BRAND;

7、获取手机型号:
android.os.Build.MODEL;

8、获取手机Android 版本:
android.os.Build.VERSION.RELEASE;

9、获取当前歌追塑App进程的id:
android.os.Process.myPid();
