照相权限和判断设备是否有相机功能

看官方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.


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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章