Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Can't use CardIOActivity.canReadCardWithCamera() with API23 permission model #136

Closed
trevor-e opened this issue Apr 13, 2016 · 3 comments
Closed

Comments

@trevor-e
Copy link

Required Information

  • card.io Android SDK Version: 5.3.2
  • Android Version and Device: Nexus 6P API23

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 calling Camera.open().

@braebot
Copy link
Member

braebot commented Apr 14, 2016

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 Camera.open() succeeds. If it fails to open a camera, assume success. Any other options are welcome for consideration. :)

@trevor-e
Copy link
Author

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?

@braebot
Copy link
Member

braebot commented Apr 14, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants