Check if device has a camera?

前端 未结 14 1183
粉色の甜心
粉色の甜心 2020-11-30 21:59

In my app, I\'d like to use the camera, if the device has one. Are there any devices running android that do not have a camera? By including the following into my m

相关标签:
14条回答
  • 2020-11-30 22:31

    you should use this to find camera in your device

    public static boolean isCameraAvailable(Context context) {
        return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
    }
    
    0 讨论(0)
  • 2020-11-30 22:31

    If you are using Android 2.3, there are some APIs that you can check your camera status, such as the number of cameras (front and back)

    0 讨论(0)
提交回复
热议问题