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

Handle runtime permissions when checking hardware support #81

Merged
merged 1 commit into from
Jun 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure there isn't another error path that should be considered?

} 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