当有人下载我的应用程序时,我想通知他他的手机是否有闪光灯。请帮我为此目的获取代码。
答案 0 :(得分:1)
Context context = this;
PackageManager packageManager = context.getPackageManager();
// if device support flash?
if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) {
//yes
Log.i("camera", "This device has flash supported!");
}else{
//no
Log.i("camera", "This device has no flash support!");
}