简体   繁体   English

在Android中如何检查设备是否具有前置闪光灯(Camera2 API)

[英]In Android how to check if device has front flash (Camera2 API)

I have developed app that can toggle rear and front flashes. 我开发了可以切换前后闪光灯的应用程序。 But if a device hasn't got front flash the app crashes. 但是,如果设备没有前置闪存,则应用程序将崩溃。 Can I check device front flash availability? 我可以检查设备正面闪存的可用性吗? Like if front flash unavailable show toast and disable the button. 就像前闪光灯不可用时一样,举杯并禁用按钮。

Any help would be appreciated. 任何帮助,将不胜感激。

Something like this I guess: 我猜是这样的:

boolean flashAvailable = cameraCharacteristics.get(cameraCharacteristics.FLASH_INFO_AVAILABLE);

public static final Key FLASH_INFO_AVAILABLE 公共静态最终密钥FLASH_INFO_AVAILABLE

Will be false if no flash is available. 如果没有可用的闪光灯,则为false

If there is no flash unit, none of the flash controls do anything. 如果没有闪光灯,则任何闪光灯控制都不会执行任何操作。 This key is available on all devices. 该密钥在所有设备上均可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM