NeutrinosPlatform / cordova-plugin-document-scanner

cordova plugin for document scan
https://www.neutrinos.co/
MIT License
85 stars 61 forks source link

Scan (often) works on second try, first try falls back to "Select Picker or Camera" Icons #65

Closed bendspoons closed 4 years ago

bendspoons commented 4 years ago

Describe the bug A new error occured (Android only!) in my implementation of this plugin. When i click my "Scan Button", the Plugin starts normal, i can take a Photo. But often the next step is NOT the cutting/draw rectangle to cut, but a black blank screen with a grey bar at screenbottom which has two Icons: Folder and Camera. When clicking the Camera button, the Plugin behaves like expected (so an extra step...).

My Code:

scan.scanDoc(function(image_uri) { console.log('++++ imageURI ' + image_uri); }, function(error) { console.log('Photo (Doc Camera) NOT captured'); }, { sourceType : 1, quality : 2.5 });

I updated to latest version (4.2.1), because i thougt at fitst it was due to using 4.0.0. But no changes.

And - to add more strange behaviour - this only happens when i use the plugin for the first time after opening the app. The next photo works normal.

video-to-gif

Thanks!

PS. I changed the localisation and icons to german (like "weiter" instead of "next"), because our main audience is Germany based. Just an info to fight confusion :)

ChrisTomAlx commented 4 years ago

Hey @bendspoons Would it be possible for you to get me the stacktrace from android studio when this issue occurs? It could be a device specific issue since I am not able to reproduce this on my end..

Cheers, Chris Neutrinos

bendspoons commented 4 years ago

Hi, i think this is the part, where the error happens:

2019-12-03 17:25:43.992 24222-24257/com.app.cordovaapp V/FA: Inactivity, disconnecting from the service 2019-12-03 17:25:44.694 24222-24233/com.app.cordovaapp W/bei.developmen: Suspending all threads took: 6.041ms 2019-12-03 17:25:45.070 24222-24222/com.app.cordovaapp W/System.err: java.io.FileNotFoundException: open failed: ENOENT (No such file or directory) 2019-12-03 17:25:45.088 24222-24222/com.app.cordovaapp W/System.err: at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:313) 2019-12-03 17:25:45.088 24222-24222/com.app.cordovaapp W/System.err: at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:211) 2019-12-03 17:25:45.089 24222-24222/com.app.cordovaapp W/System.err: at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1308) 2019-12-03 17:25:45.089 24222-24222/com.app.cordovaapp W/System.err: at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1236) 2019-12-03 17:25:45.089 24222-24222/com.app.cordovaapp W/System.err: at com.scanlibrary.PickImageFragment.getBitmap(PickImageFragment.java:388) 2019-12-03 17:25:45.089 24222-24222/com.app.cordovaapp W/System.err: at com.scanlibrary.PickImageFragment.onActivityResult(PickImageFragment.java:315) 2019-12-03 17:25:45.089 24222-24222/com.app.cordovaapp W/System.err: at android.app.Activity.dispatchActivityResult(Activity.java:7824) 2019-12-03 17:25:45.089 24222-24222/com.app.cordovaapp W/System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:5071) 2019-12-03 17:25:45.089 24222-24222/com.app.cordovaapp W/System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:5120) 2019-12-03 17:25:45.089 24222-24222/com.app.cordovaapp W/System.err: at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) 2019-12-03 17:25:45.090 24222-24222/com.app.cordovaapp W/System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 2019-12-03 17:25:45.090 24222-24222/com.app.cordovaapp W/System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 2019-12-03 17:25:45.090 24222-24222/com.app.cordovaapp W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199) 2019-12-03 17:25:45.090 24222-24222/com.app.cordovaapp W/System.err: at android.os.Handler.dispatchMessage(Handler.java:112) 2019-12-03 17:25:45.090 24222-24222/com.app.cordovaapp W/System.err: at android.os.Looper.loop(Looper.java:216) 2019-12-03 17:25:45.090 24222-24222/com.app.cordovaapp W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7625) 2019-12-03 17:25:45.090 24222-24222/com.app.cordovaapp W/System.err: at java.lang.reflect.Method.invoke(Native Method) 2019-12-03 17:25:45.090 24222-24222/com.app.cordovaapp W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) 2019-12-03 17:25:45.091 24222-24222/com.app.cordovaapp W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

bendspoons commented 4 years ago

Seems like the picture is not saved at all, thus the Plugin fails to laod the image to "scan".... Using a Huawei Mate 20 Smartphone. Going to check on some Samsung devices later.

ChrisTomAlx commented 4 years ago

Hey @bendspoons

Could you make a minimal app which can recreate this issue and send it over. I can get into testing it on my side when possible.

Cheers, Chris Neutrinos

bendspoons commented 4 years ago

Sorry, im late... The problem was caused by my attempt to remove the original Image from scanFolder.

I had acccidentially added the Delete Code where it deleted the taken Photo before the Document Scanner could process the image. And it worked on second try because the "trouble-making-function" was onyl called once on first try... my bad, anyways, as always, thanks for your help!

GuntherG commented 1 year ago

Hello, we are using the plugin which works great but how can we add localisation?