-
Notifications
You must be signed in to change notification settings - Fork 534
Can't use CardIOActivity.canReadCardWithCamera() with API23 permission model #136
Comments
Ideally yes. I didn't look into this method when adding API 23 support, but agree that it should be considered. Please correct me if I'm wrong, but I assume that we should return whether the device is 'capable' of scanning cards, and ignore whether the app has permissions. This means that the user could have already rejected camera permissions, but this method would continue to return true. Looks like that method only checks that a camera can open, and that the resolution of the camera is sufficient. From what I can tell, we can 1: skip the camera check entirely, or 2: only proceed with resolution check if |
Yup, that's exactly it. :) Option 2 seems like the better option, but what would happen if the resolution check fails later on? Is there any other way to query the camera information? |
There might be in API 21+ with the new camera2 API. Since camera2 only supports API 21+, we'd need to support the old code path for API 20-, which shouldn't be a problem since the new permission model was added in API 23. |
Return true for CardIOActivity#canReadCardWithCamera when camera cannot be access on API >= 23. Fixes card-io/card.io-Android-SDK#136
Required Information
Issue Description
I'm trying to use
CardIOActivity.canReadCardWithCamera()
to only show the card scanning icon if the device supports it. When targeting API23, this method no longer works because it fails every time when trying to connect to the camera, presumably because the permission hasn't been approved. Ideally there should be a safe way to check whether the device hardware supports CardIO's features without callingCamera.open()
.The text was updated successfully, but these errors were encountered: