Skip to content

Instantly share code, notes, and snippets.

@zplesac
Created September 1, 2016 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zplesac/66b63981413ac137746395df6d0b9f94 to your computer and use it in GitHub Desktop.
Save zplesac/66b63981413ac137746395df6d0b9f94 to your computer and use it in GitHub Desktop.
try {
RecognizerCompatibilityStatus status = RecognizerCompatibility.getRecognizerCompatibilityStatus(this);
if (status == RecognizerCompatibilityStatus.RECOGNIZER_SUPPORTED) {
RecognitionSettings settings = new RecognitionSettings();
settings.setRecognizerSettingsArray((RecognizerSettings[]) object);
if (!RecognizerCompatibility.cameraHasAutofocus(CameraType.CAMERA_BACKFACE, this)) {
RecognizerSettings[] recognizerSettings = settings.getRecognizerSettingsArray();
recognizerSettings = RecognizerSettingsUtils.filterOutRecognizersThatRequireAutofocus(recognizerSettings);
settings.setRecognizerSettingsArray(recognizerSettings);
}
mScanView = new RecognizerView(this);
mScanView.setRecognitionSettings(settings);
mScanView.setLicenseKey(getString(R.string.blink_licence));
mScanView.setKeepScreenOn(true);
mScanView.setCameraType(CameraType.CAMERA_BACKFACE);
mScanView.setAspectMode(CameraAspectMode.ASPECT_FILL);
mScanView.setForceUseLegacyCamera(true);
mScanView.setScanResultListener(this);
mScanView.setCameraEventsListener(this);
mScanView.create();
mScanFrame.addView(mScanView);
} else {
showDeviceNotSupportedDialog();
}
} catch (Exception e) {
e.printStackTrace();
showDeviceNotSupportedDialog();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment