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

Commit

Permalink
Handle runtime permissions when checking hardware support
Browse files Browse the repository at this point in the history
Return true for CardIOActivity#canReadCardWithCamera when camera cannot be access on API >= 23.

Fixes card-io/card.io-Android-SDK#136
  • Loading branch information
lkorth committed May 27, 2016
1 parent cc8d133 commit 509b613
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions card.io/src/main/java/io/card/payment/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ private static boolean hardwareSupportCheck() {
try {
c = Camera.open();
} catch (RuntimeException e) {
Log.w(PUBLIC_LOG_TAG, "- Error opening camera: " + e);
throw new CameraUnavailableException();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return true;
} else {
Log.w(PUBLIC_LOG_TAG, "- Error opening camera: " + e);
throw new CameraUnavailableException();
}
}
if (c == null) {
Log.w(PUBLIC_LOG_TAG, "- No camera found");
Expand Down

0 comments on commit 509b613

Please sign in to comment.