NeutrinosPlatform / cordova-plugin-document-scanner

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

Low Memory error on Android 10 #74

Open wimZ opened 4 years ago

wimZ commented 4 years ago

ScanDoc after the camera finishes, sometimes comes with a Low Memory warning. It seems related to the complexity/darkness of the image. the app does not crash since the library fix (4.2.5), but continues after a tap/back. I have tried with image-quality 1 and 2.5 with the same result.
I never observed this issue on Android 9, but it appeared after upgrading to Android 10.

This is the error message ScanDoc Low Memory Error

Versions:

If there any additional info or assistance is needed, please let me know. I appreciate any suggestions.

atebsy commented 4 years ago

I have observed the same issue on my side

ChrisTomAlx commented 4 years ago

This issue has to be fixed in the library. Not sure when I will be able to take a look at it though. This is a good starting point anyone trying to tackle this issue.

Cheers, Chris Neutrinos

sachiv-logiciel commented 4 years ago

I am getting the same issue in my ionic project. is somebody find any way to fix this problem?

narupareliya commented 4 years ago

Same issue im facing, help me asap.

narupareliya commented 4 years ago

I have observed the same issue on my side

when will u fix this?

narupareliya commented 4 years ago

@ChrisTomAlx Can u tell me when u will help Low memory issue in plugin

ChrisTomAlx commented 4 years ago

There is no timeline as of now. So I don't really have an immediate answer for you. But I can look at any PRs that are raised to address this issue.

Cheers, Chris Neutrinos

narupareliya commented 4 years ago

Any Luck??

On Wed, Jul 29, 2020 at 6:08 PM Christy Thomas Alex < notifications@github.com> wrote:

There is no timeline as of now. So I don't really have an immediate answer for you. But I can look at any PRs that are raised to address this issue.

Cheers, Chris https://github.com/ChrisTomAlx Neutrinos http://www.neutrinos.co/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-665639003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXNPZCBEZA6NXAKFKL6F63R6AJ5VANCNFSM4M7W7HFQ .

narupareliya commented 4 years ago

Same issue after done above steps

On Sun, Aug 16, 2020 at 11:52 AM Anshuman Nayak notifications@github.com wrote:

@ChrisTomAlx https://github.com/ChrisTomAlx @sachiv-logiciel https://github.com/sachiv-logiciel @wimZ https://github.com/wimZ @narupareliya https://github.com/narupareliya I solved this issue of "LOW MEMORY" . follow the steps below to use in your corodova projects

  1. add this plugin to your project "cordova plugin add cordova-plugin-document-scannner".
  2. build it once .
  3. Download the scanlibrary from Neutrinos github repository ( I used scanlibrary -2.5). link:- click here https://github.com/NeutrinosPlatform/scanlibrary/tree/v2.5
  4. unzip the scanlibrary
  5. open with android studio
  6. wait for gradle sync to finish
  7. add required sdks and build tools ( You can otherwise edit the version inside "library/build.gradle" file to adjust it to your available sdk and build tool ).
  8. restart the Android studio.
  9. wait for gradle sync to finish.
  10. Build your project
  11. after successful build you will get a 'library-debug.arr' inside the "library/builds/outputs/arr/".
  12. copy that file.
  13. Go to "C:\Users\USER_NAME.gradle\caches\modules-2\files-2.1\com.github.NeutrinosPlatform\scanlibrary\2.5\6209d26ba4ea44188835ca326adb4a3db9cfd7af" (since this is a temporary directory name will vary from system to system , you can apply a search in windows search tool using keyword "scanlibrary-2.5.aar"(version name varies)).
  14. Paste your "library-debug.arr" inside it .
  15. copy the name of previous '.arr' file present inside the directory.(ex. scanlibrary-2.5.aar ) .
  16. Delete the previous file (ex. scanlibrary-2.5.aar).
  17. Rename your copied file (library-debug.arr) to (scanlibrary-2.5.aar).
  18. Thats it ! 💯 💯 🥇 You can also change the code according to your requirement . Thank Neutrinos platform for such beautiful library Enjoy Your patching .Now your patching done There should be no "Low Memory" warning after this. (TESTED OK ,ANSHUMAN NAYAK ,CTO N3XVERSE PVT. LTD. ). for any other issue feel free to contact me at : Mail http://anshuman@nexsb.in 👍

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-674485685, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXNPZECZACBMFVHHXRLPYLSA53LBANCNFSM4M7W7HFQ .

anshumanfs commented 4 years ago

Are You sure , because I have tried and using this in my application without any error

Don't forget to build your SDK after editing the library

Can you provide the portion you edited.

On Tue, 18 Aug, 2020, 9:58 AM WAS Developer, notifications@github.com wrote:

Same issue after done above steps

On Sun, Aug 16, 2020 at 11:52 AM Anshuman Nayak notifications@github.com wrote:

@ChrisTomAlx https://github.com/ChrisTomAlx @sachiv-logiciel https://github.com/sachiv-logiciel @wimZ https://github.com/wimZ @narupareliya https://github.com/narupareliya I solved this issue of "LOW MEMORY" . follow the steps below to use in your corodova projects

  1. add this plugin to your project "cordova plugin add cordova-plugin-document-scannner".
  2. build it once .
  3. Download the scanlibrary from Neutrinos github repository ( I used scanlibrary -2.5). link:- click here https://github.com/NeutrinosPlatform/scanlibrary/tree/v2.5
  4. unzip the scanlibrary
  5. open with android studio
  6. wait for gradle sync to finish
  7. add required sdks and build tools ( You can otherwise edit the version inside "library/build.gradle" file to adjust it to your available sdk and build tool ).
  8. restart the Android studio.
  9. wait for gradle sync to finish.
  10. Build your project
  11. after successful build you will get a 'library-debug.arr' inside the "library/builds/outputs/arr/".
  12. copy that file.
  13. Go to

"C:\Users\USER_NAME.gradle\caches\modules-2\files-2.1\com.github.NeutrinosPlatform\scanlibrary\2.5\6209d26ba4ea44188835ca326adb4a3db9cfd7af" (since this is a temporary directory name will vary from system to system , you can apply a search in windows search tool using keyword "scanlibrary-2.5.aar"(version name varies)).

  1. Paste your "library-debug.arr" inside it .
  2. copy the name of previous '.arr' file present inside the directory.(ex. scanlibrary-2.5.aar ) .
  3. Delete the previous file (ex. scanlibrary-2.5.aar).
  4. Rename your copied file (library-debug.arr) to (scanlibrary-2.5.aar).
  5. Thats it ! 💯 💯 🥇 You can also change the code according to your requirement . Thank Neutrinos platform for such beautiful library Enjoy Your patching .Now your patching done There should be no "Low Memory" warning after this. (TESTED OK ,ANSHUMAN NAYAK ,CTO N3XVERSE PVT. LTD. ). for any other issue feel free to contact me at : Mail http://anshuman@nexsb.in 👍

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-674485685 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AKXNPZECZACBMFVHHXRLPYLSA53LBANCNFSM4M7W7HFQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-675241891, or unsubscribe https://github.com/notifications/unsubscribe-auth/APMUDCIK4B2PYNTM6HVOB33SBH7NRANCNFSM4M7W7HFQ .

NautamSanghani commented 4 years ago

cordova plugin add cordova-plugin-document-scannner

Command failed with exit code 1: npm view cordova-plugin-document-scannner --json npm ERR! code E404 npm ERR! 404 'cordova-plugin-document-scannner' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! 404 npm ERR! 404 'cordova-plugin-document-scannner@latest' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR! /home/nalin/.npm/_logs/2020-08-20T04_54_06_917Z-debug.log { "error": { "code": "E404", "summary": "'cordova-plugin-document-scannner' is not in the npm registry.\nYou should bug the author to publish it\n(or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url.", "detail": "\n 'cordova-plugin-document-scannner@latest' is not in the npm registry.\nYou should bug the author to publish it (or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url." } }

anshumanfs commented 4 years ago

cordova plugin add cordova-plugin-document-scannner

Command failed with exit code 1: npm view cordova-plugin-document-scannner --json npm ERR! code E404 npm ERR! 404 'cordova-plugin-document-scannner' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! 404 npm ERR! 404 'cordova-plugin-document-scannner@latest' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR! /home/nalin/.npm/_logs/2020-08-20T04_54_06_917Z-debug.log { "error": { "code": "E404", "summary": "'cordova-plugin-document-scannner' is not in the npm registry.\nYou should bug the author to publish it\n(or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url.", "detail": "\n 'cordova-plugin-document-scannner@latest' is not in the npm registry.\nYou should bug the author to publish it (or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url." } }

@NautamSanghani sorry Bro by mistake I used ""cordova-plugin-document-scannner"" , which is actually "cordova-plugin-document-scanner"( spell mistakes)

narupareliya commented 4 years ago

Thanks NeutrinosPlatform/cordova-plugin-document-scanner solve my issue

On Fri, Aug 21, 2020 at 8:27 AM Anshuman Nayak notifications@github.com wrote:

cordova plugin add cordova-plugin-document-scannner

Command failed with exit code 1: npm view cordova-plugin-document-scannner --json npm ERR! code E404 npm ERR! 404 'cordova-plugin-document-scannner' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! 404 npm ERR! 404 'cordova-plugin-document-scannner@latest' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR! /home/nalin/.npm/_logs/2020-08-20T04_54_06_917Z-debug.log { "error": { "code": "E404", "summary": "'cordova-plugin-document-scannner' is not in the npm registry.\nYou should bug the author to publish it\n(or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url.", "detail": "\n 'cordova-plugin-document-scannner@latest' is not in the npm registry.\nYou should bug the author to publish it (or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url." } }

@NautamSanghani https://github.com/NautamSanghani sorry Bro by mistake I used ""cordova-plugin-document-scannner"" , which is actually "cordova-plugin-document-scanner"( spell mistakes)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-678009897, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXNPZGVOJO2USJRU766XALSBXO77ANCNFSM4M7W7HFQ .

SeaEagleEye commented 3 years ago

It's not working in Android 10, Samsung Galaxy J8 mobile after taking picture it's showing black screen blankScreen

davidquon commented 3 years ago

I'm having the same black screen problem as https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-688596560 running Android 10 on a Samsung Galaxy S9. I'm using Ionic and Cordova with this plugin.

Ionic CLI         : 6.11.8
Cordova CLI       : 10.0.0
Cordova Platforms : android 9.0.0, ios 6.1.0
SeaEagleEye commented 3 years ago

remove platform android and run ionic cordova platform add android@8.0.0

davidquon commented 3 years ago

remove platform android and run ionic cordova platform add android@8.0.0

@SeaEagleEye Do you know what the issue is requiring moving back to 8.0.0?

SeaEagleEye commented 3 years ago

No It's just a quick fix

On Thu, Sep 17, 2020 at 4:28 AM David Quon notifications@github.com wrote:

remove platform android and run ionic cordova platform add android@8.0.0

@SeaEagleEye https://github.com/SeaEagleEye Do you know what the issue is requiring moving back to 8.0.0?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-693709197, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMRHUC5MESIZI7AX2NBNKGDSGE7LDANCNFSM4M7W7HFQ .

NautamSanghani commented 3 years ago

Anybody got solutions for multi scan

On Thu, 17 Sep, 2020, 12:02 pm Prajwal, notifications@github.com wrote:

No It's just a quick fix

On Thu, Sep 17, 2020 at 4:28 AM David Quon notifications@github.com wrote:

remove platform android and run ionic cordova platform add android@8.0.0

@SeaEagleEye https://github.com/SeaEagleEye Do you know what the issue is requiring moving back to 8.0.0?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-693709197 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AMRHUC5MESIZI7AX2NBNKGDSGE7LDANCNFSM4M7W7HFQ

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-693971609, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIY3VVHI5AN3PCIZJMUJELDSGGURTANCNFSM4M7W7HFQ .

ChrisTomAlx commented 3 years ago

Does using cordova-android 8.0.0 fix this issue for you as well @davidquon? Don't have a device to replicate this issue so would appreciate it if you could get back on the status.

Cheers, Chris Neutrinos

wimZ commented 3 years ago

For me it works on android 8.0 using android-targetSdkVersion: 29

wimZ commented 3 years ago

Unluckily it does not work on 8.1.0, and that is the version that enables application bundles (.aab)

ChrisTomAlx commented 3 years ago

That is really strange. I will try and pick this up as soon as work on the plugin starts again

Thanks for all the testing you guys have done :)

Cheers, Chris Neutrinos

NautamSanghani commented 3 years ago

Can you implement multi scan functionality If you implement that will be great

On Mon, 21 Sep, 2020, 1:39 pm Christy Thomas Alex, notifications@github.com wrote:

That is really strange. I will try and pick this up as soon as work on the plugin starts again

Thanks for all the testing you guys have done :)

Cheers, Chris https://github.com/ChrisTomAlx Neutrinos http://www.neutrinos.co/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-695966751, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIY3VVERRZLO7YBIKHUG2SLSG4C2PANCNFSM4M7W7HFQ .

ChrisTomAlx commented 3 years ago

@NautamSanghani please don't hijack issues. There is another similar issue #31 . You can leave your thoughts there. It has already been considered as an enhancement but not sure when we will get around to it.

Cheers, Chris Neutrinos

benediktcarda commented 3 years ago

I can confirm the observation of SeaEagleEye that the plugin shows the black screen after taking the picture. Anyway reverting to cordova platform Android 8 did not solve the issue for me.

ChrisTomAlx commented 3 years ago

Released a new beta version of the plugin.

To test it :-

  1. Make sure to remove the old version using cordova plugin rm cordova-plugin-document-scanner
  2. To test it add the following to your project
    • cordova plugin add cordova-plugin-document-scanner@5.0.0-beta.0
    • cordova plugin add cordova plugin add cordova-plugin-androidx
    • cordova plugin add cordova-plugin-androidx-adapter

If you guys could help by testing this beta version and let me know if it solved your issue, I can release the 5.0.0 version. Latest plugin also solves this issue

Cheers and have a nice day :) Chris Neutrinos

wimZ commented 3 years ago

Thx, I'll go test later this week.

:)

wimZ

10 nov. 2020 13:21:08 Christy Thomas Alex notifications@github.com:

Released a new beta version[https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fcordova-plugin-document-scanner%2Fv%2F5.0.0-beta.0&data=04%7C01%7C%7Cdf4d06b868234f10bdb808d8857319f2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406076679719337%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5HZdIc75QW7ucTeVc6S74uIH0%2B4tATaXVfSev3A419s%3D&reserved=0] of the plugin.

To test it :-

Cheers and have a nice day :) Chris[https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FChrisTomAlx&data=04%7C01%7C%7Cdf4d06b868234f10bdb808d8857319f2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406076679729333%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=NuNFEOvx3pQYipTQL0WNbkEm3tPPqJm9ts8qjZoUl5M%3D&reserved=0] Neutrinos[https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.neutrinos.co%2F&data=04%7C01%7C%7Cdf4d06b868234f10bdb808d8857319f2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406076679729333%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ab4a7AD8DamUkCt85OlFAi4dANZtTwzVvDE4v0CPGNg%3D&reserved=0]

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub[https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNeutrinosPlatform%2Fcordova-plugin-document-scanner%2Fissues%2F74%23issuecomment-724667450&data=04%7C01%7C%7Cdf4d06b868234f10bdb808d8857319f2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406076679729333%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=alidF4T79iXGtq2%2BtZZV0dN0Jo7iISrw4Ijn0PaR89Y%3D&reserved=0], or unsubscribe[https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAD2YDNNDXSDW4HGY3DCMAJDSPEV3HANCNFSM4M7W7HFQ&data=04%7C01%7C%7Cdf4d06b868234f10bdb808d8857319f2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406076679739328%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8mB%2BCz8im1jEOy%2BZuWah342Dc0LUW6OjRi9tFSalW3o%3D&reserved=0]. [https://github.com/notifications/beacon/AD2YDNKYEMZM6M72VU47OVTSPEV3HA5CNFSM4M7W7HF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFMYYYOQ.gif]

ChrisTomAlx commented 3 years ago

Thanks @wimZ Appreciate it :))

Cheers, Chris Neutrinos

benediktcarda commented 3 years ago

I tested the beta but the behaviour does not change. After taking the photo it still shows the black screen like SeaEagleEye showed on 8 Sep.

Additional information, but probably not a problem. When adding the plugin "cordova-plugin-androidx" I get the following output:

cordova plugin add cordova-plugin-androidx Installing "cordova-plugin-androidx" for android Plugin doesn't support this project's cordova-android version. cordova-android: 9.0.0, failed version requirement: <9.0.0 Skipping 'cordova-plugin-androidx' for android Adding cordova-plugin-androidx to package.json

Seems like cordova android 9.0 doesn't need cordova-plugin-androidx?

wimZ commented 3 years ago

I just tested it as well.

I get a scanDoc error result ‘incorrect result or user cancelled the action’

Are there minimum version dependencies?

Regards, wim

ChrisTomAlx commented 3 years ago

@benediktcarda @wimZ Could you guys add the following to config.xml as suggested by this comment and see if the issue persists?

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
   <application android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true"/>
</edit-config>

Also @benediktcarda it does not matter that cordova-plugin-androidx is deprecated, just add it nonetheless and add the other one too. You can ignore the deprecation notice and continue.

Cheers, Chris Neutrinos

wimZ commented 3 years ago

On first try it works!

I’ll do some more testing later

Thanks

benediktcarda commented 3 years ago

After adding

`

`

it started to work again (I can crop the scanned pages and save to my application), but now I get the low memory message wimZ reported initially.

ChrisTomAlx commented 3 years ago

@wimZ If possible when you reply via email click the 3 dots and remove the history then respond. I have edited your comments and removed the unnecessary reply quotes for now. Also thanks for helping with the testing :). Let me know if you face any other issues in your testing. I will also fix this need to request legacy storage before I release ver 5.0.0.

@benediktcarda Is it just showing low memory error and then you are able to scan normally? or low memory then it just keeps opening up the camera UI over and over again until app crashes? If you are able to continue normally it might actually be an issue with memory and this is expected behavior. Either way let me see what I can find and thank for testing the beta version :)

Cheers, Chris Neutrinos

onlyplaytama commented 3 years ago

hi @ChrisTomAlx ..

i saw in your scan library

createdirectory when opencamera is not working with API 29

even if i put androidxand this one still not working also <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application"> <application android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true"/> </edit-config>

and this code one is not working anymore with API 29 , Environment.getExternalStorageDirectory()

i did debug , and i found this :

W/System.err: java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
W/System.err:     at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:315)
W/System.err:     at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:220)
        at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1505)
        at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1427)
        at com.scanlibrary.PickImageFragment.getBitmap(PickImageFragment.java:238)
        at com.scanlibrary.PickImageFragment.onActivityResult(PickImageFragment.java:165)
        at android.app.Activity.dispatchActivityResult(Activity.java:8319)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5090)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5138)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7814)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)

and also this one , i think this one when opencamera function

W/System.err:     at com.scanlibrary.PickImageFragment.clearTempImages(PickImageFragment.java:75)
        at com.scanlibrary.PickImageFragment.createImageFile(PickImageFragment.java:148)
        at com.scanlibrary.PickImageFragment.openCamera(PickImageFragment.java:128)
        at com.scanlibrary.PickImageFragment.handleIntentPreference(PickImageFragment.java:85)
        at com.scanlibrary.PickImageFragment.init(PickImageFragment.java:66)
        at com.scanlibrary.PickImageFragment.onCreateView(PickImageFragment.java:56)
        at android.app.Fragment.performCreateView(Fragment.java:2534)
        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1303)
W/System.err:     at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2431)
        at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2210)
        at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2166)
        at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2067)
        at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3057)
        at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3004)
        at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:184)
        at android.app.Activity.performCreate(Activity.java:7962)
        at android.app.Activity.performCreate(Activity.java:7944)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3423)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7814)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
D/: openCamera: isDirectoryCreated: false

already try run with your scanlibrary 3.2 still not working

Update : i found that Storage permission are not Allowed , already put <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> in AndroidManifest.xml but its not working , after i turn on allow manually from setting->apps->permision . its working

reg, tama

sergiuturus commented 3 years ago

I also get the "Incorrect result or user cancelled the action" message when I take a photo.

Adding android:requestLegacyExternalStorage="true" to the AndroidManifest.xml seems to fix the problem but idk if this is a viable solution as @ChrisTomAlx noted here https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/82#issuecomment-725231041

ChrisTomAlx commented 3 years ago

@sergiuturus Released 5.0.0-beta.1 of this plugin with the fixes. Let me know if this fixes your issue.

To test it :-

  1. Make sure to remove the old version using cordova plugin rm cordova-plugin-document-scanner
  2. To test it add the following to your project
    • cordova plugin add cordova-plugin-document-scanner@5.0.0-beta.1
    • cordova plugin add cordova-plugin-androidx
    • cordova plugin add cordova-plugin-androidx-adapter

Cheers and have a nice day :) Chris Neutrinos

ChrisTomAlx commented 3 years ago

@onlyplaytama You could try and use the diagnostic plugin to manage permissions.

Cheers and have a nice day :) Chris Neutrinos

HerickRaposo commented 3 years ago

In my case, on android, the plugin dont clear images, how can i exclude generated image by plugin?

HerickRaposo commented 3 years ago

The comand cordova plugin add cordova-plugin-document-scanner@5.0.0-beta.1 work to me, but dont clear saved images in android

rubenmiq commented 3 years ago

@sergiuturus Released 5.0.0-beta.1 of this plugin with the fixes. Let me know if this fixes your issue.

To test it :-

  1. Make sure to remove the old version using cordova plugin rm cordova-plugin-document-scanner
  2. To test it add the following to your project

    • cordova plugin add cordova-plugin-document-scanner@5.0.0-beta.1
    • cordova plugin add cordova-plugin-androidx
    • cordova plugin add cordova-plugin-androidx-adapter

Cheers and have a nice day :) Chris Neutrinos

Still showing the low memory message, but in the end the scan is made. I am using cordova android 9.0.0 so i did not install the AndroidX plugins, because they are not compatible with version 9

HerickRaposo commented 3 years ago

@sergiuturus Lançado 5.0.0-beta.1 deste plugin com as correções. Avise-me se isso resolver o seu problema.

Para testar: -

  1. Certifique-se de remover a versão antiga usando cordova plugin rm cordova-plugin-document-scanner
  2. Para testá-lo, dependerá do seguinte ao seu projeto

    • cordova plugin add cordova-plugin-document-scanner@5.0.0-beta.1
    • cordova plugin add cordova-plugin-androidx
    • cordova plugin add cordova-plugin-androidx-adapter

Saúde e tenha um bom dia :) Chris Neutrinos

I solved the exclusion problem using the cordova file plugin.however I was unable to remove the low memory message. How can I hide it? Do you have a solution? If so tell me where I should modify that I even fork or branch

getCamera(){
       let opts: DocumentScannerOptions = {
      sourceType:1,
      quality:2.0,
      returnBase64: false,
    };
    this.documentScanner.scanDoc(opts)
    .then((res) =>{
      console.log(res)
        if (this.platform.is('ios')) {
          let img = this.webview.convertFileSrc(res)
          let imagemTratada = this.domSanatize.bypassSecurityTrustUrl(img)
          this.images.push(imagemTratada)
          this.caminhoImg.push(res)
        } else {
          this.filePath.resolveNativePath(res).then((url) => {
            //Data = file:///storage/emulated/0/Pictures/ + nome da imagem
            this.filePath.resolveNativePath(res).then((data) => {
              let filename =  res.substring(res.lastIndexOf('/') +1);
              let path = res.substring(0,res.lastIndexOf('/') +1)

              this.file.readAsDataURL(path,filename).then((base64string) => {
                console.log(base64string)
                this.images.push(base64string)
                this.file.resolveDirectoryUrl(this.file.cacheDirectory).then(data => {
                  console.log(data.nativeURL) ;
                  this.file.moveFile(path, filename, data.nativeURL,filename).then((resposta)=>{
                    console.log(resposta)
                    console.log(resposta.nativeURL)
                    this.caminhoImg.push(resposta.nativeURL)
                  }).catch((error) => console.log(error))
                });
              })
            })
          })

        }
        this.verificaCondicao();
    })
    .catch((error) => console.error(error));
  }

limpaDiretorio(){
    this.file.resolveDirectoryUrl(this.file.externalRootDirectory ).then((data)=>{
      let caminho = data.nativeURL
      this.file.removeRecursively(caminho, 'scanSample').then((res) =>{
        console.log(res)
        this.limpaCache();
      }).catch(error => {
        console.log(error)
        this.limpaCache();
      })
    }).catch(error => console.log(error))
  }

  limpaCache(){
    this.file.resolveDirectoryUrl(this.file.cacheDirectory).then(data => {
      this.file.listDir(data.nativeURL, '').then(async (res) => {
        console.log(res)
        if (res.length > 0 ) {
          for (let i = 0; i < res.length; i++) {

            await this.file.resolveLocalFilesystemUrl(res[i].nativeURL).then((newNativeURL)=> {
              newNativeURL.remove(
                ()=>console.log('sucesso ao excluir'), 
                ()=>console.log('Erro ao excluir')
              );
            })
          }
        }
      })
    });
  }
ManishBolbanda-dev commented 3 years ago

can some one give me the code to get Base64 of image in Pictures. path : file:///storage/emulated/0/Pictures/my_image.jpg am trying to get base64 string from Base64 & File plugins but through both the approach am getting null outpot

benediktcarda commented 2 years ago

The problem that after taking a picture it's showing a black screen is back. Got it reported from a user and tried it myself. When having the blank black screen you can do nothing but either click on the camera icon and take another photo (which again leads to the black screen) or you can click on the folder icon, choose another photo from the gallery and even manipulate the edges but as soon as you click "save" you get the error:

open /storage/emulated/0/Pictures/Title - Sun Mar 13 16-23_45 GMT+01_00 2000.jpg: open failed: EACCES (Permission denied)

Dbouwheer commented 2 years ago

@ChrisTomAlx : just a thought, but i do not have any app building experience.

The error pops up just after the "cropping/automatic edge selection" stage. It seems to me that the “cropping” is done while the photo taken is still in high quality. Is this a very memory intentive task? Otherwise maybe descaled the image to a lower quality before this stage. Instead of adjusting the quality in a later stage.

Will delete the comment if i'm talking nonsense ;)

pedro172023 commented 1 year ago

Hola ¿Alguien ha podido encontrar solucion a este problema?