时间:2021-01-11 11:02:55 | 栏目:Android代码 | 点击:次
通过PackageManager可以判断android设备是否有相机
PackageManager pm = getPackageManager(); // FEATURE_CAMERA - 后置相机 // FEATURE_CAMERA_FRONT - 前置相机 if (!pm.hasSystemFeature(PackageManager.FEATURE_CAMERA) && !pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)) { Log.i("camera", "non-support"); } else { Log.i("camera", "support"); }