看官方API發現的一行,記錄下來
<manifest ... > <uses-feature android:name="android.hardware.camera" /> ... </manifest ... >
文檔說調用相機功能要增加這行到配置文件裏,表明用到相機功能。(貌似根據網上例子沒加這個也能打開默認相機功能。)
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.
要通過這個來檢查設備是否有照相機功能,沒有的話就要根據情況調整,或者是關閉相機功能,避免出錯。