blinkcard / blinkcard-android

SDK for scanning and OCR of credit or payment cards. Contains native Android SDK, code samples and documentation.
45 stars 5 forks source link

Unable to open camera, getting exception #3

Closed ajay011 closed 1 year ago

ajay011 commented 5 years ago

I'm getting following exception when i tried to open camera for scanning :

RecognizerRunnerView.java:501@Camera1: Exception caught on camera startup java.lang.RuntimeException: startPreview failed

After getting this exception even my phone camera stopped working, i had to restart my phone for proper working.

i1E commented 5 years ago

Hi @ajay011,

which device you are using? This can be caused by buggy camera driver on the device.

Did this happen in our sample application, or in your application?

ajay011 commented 5 years ago

I'm using Redmi Note 3, android os - 6.0.1. No, its not happening on sample application. It occurred in my app after integrating blinkcard.

i1E commented 5 years ago

Hi @ajay011,

can you please share parts of your code which call our API?

If you are building your own scan activity, like descrbed here, please make sure that you are passing all activity's lifecycle methods to RecognizerRunnerView. For example in onCreate method of your activity, you have to call RecognizerRunnerView.create().

ajay011 commented 5 years ago

I'm using following method to start scanning.

private void startScanning() { // Settings for BlinkCardActivity Activity BlinkCardUISettings settings = new BlinkCardUISettings(mRecognizerBundle); ActivityRunner.startActivityForResult(this, REQUEST_CODE, settings); }

And in onActivityResult checking for the result @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE) { if (resultCode == BlinkCardActivity.RESULT_OK && data != null) { // load the data into all recognizers bundled within your RecognizerBundle mRecognizerBundle.loadFromIntent(data); BlinkCardRecognizer.Result result = mRecognizer.getResult(); if (result.getResultState() == Recognizer.Result.State.Valid) { // set the Card Detail } } } }

krizaa commented 1 year ago

This issue was closed because it has been inactive for such a long time. If the issue persists, please open a new one.