AndroidScannerDemo icon indicating copy to clipboard operation
AndroidScannerDemo copied to clipboard

Camera Code Does not Work

Open HenryTH45 opened this issue 3 years ago • 4 comments

The Document Selection Works Fine however When i Open my Camera and Take a Picture it Sends me back to pick_image_fragment.xml File without the Image i just took.

HenryTH45 avatar Mar 11 '21 13:03 HenryTH45

@HenryTH45 You can solve this by using the below steps.

  • Create your own FileProvider and extends FileProvider public class MyFileProvider extends FileProvider{ }

  • Add this provider to your Manifest file inside application tag <application> <providerandroid:name=".MyFileProvider" android:authorities="${applicationId}.yourPackagehere.provider" android:exported="false" android:grantUriPermissions="true"><meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/yourFileName_provider_paths"/> </provider> </application>

  • Then Create a XML folder in res and create a file yourFileName_provider_paths.xml and then copy-paste the below code <?xml version="1.0" encoding="utf-8"?> <paths xmlns:android="http://schemas.android.com/apk/res/android"> <external-files-path name="external_files_files" // you can give your app name here path="." /> </paths>

akashk2512 avatar Mar 17 '21 09:03 akashk2512

@HenryTH45 remove your app manifest file provider , then it will work, scan library manifest have its own file provider, mine is working

ashwinjawale24 avatar May 08 '21 08:05 ashwinjawale24

@ashwinjawale24 do u mean to delete the base app's AndroidManifest.xml file? If did so the app runs into errors. Could u specify exactly what to do or send your repo link?

dhairyashah1 avatar May 21 '21 15:05 dhairyashah1

@dhairyashah1 No not the manifest file but, if you have file provider in your manifest remove it. because scanLibrary Module manifest has its own file provider. camera will work then

ashwinjawale24 avatar May 22 '21 10:05 ashwinjawale24