通过编程来检查Android手机是否有闪光灯

时间:2014-04-12 10:00:45

标签: android flash

当有人下载​​我的应用程序时,我想通知他他的手机是否有闪光灯。请帮我为此目的获取代码。

1 个答案:

答案 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!");
}