android 判断设备是否有相机功能

2025-02-26 01:57:10
推荐回答(2个)
回答1:

转:
看官方API发现的一行,记录下来



...


文档说调用相机功能要增加这行到配置文件里,表明用到相机功能。(貌似根据网上例子没加这个也能打开默认相机功能。)

It's then your responsibility to check for the availabilityof the camera at runtime by callinghasSystemFeature(PackageManager.FEATURE_CAMERA).If a camera is not available, you should then disable your camera features.

要通过这个来检查设备是否有照相机功能,没有的话就要根据情况调整,或者是关闭相机功能,避免出错。

回答2:

有摄像头就有