Hello, I have an ionic app for android. It has a feature like capture image using camera, choose image from gallery and choose file like image/pdf (choose file implemented using ionic Chooser plugin). So far everything works good if the app is run on emulator or if the APK installed directly on device.
The problem arises when there are multiple profile on device eg: Personal and Work profile. The app will be distributed from Work profile. Now when I try to capture the image using camera or select an image from gallery or choose any file using file chooser (from Personal Profile) there is a problem in saving the file to the app’s directory. The App directory path points to “file.documentsDirectory” and using “file.writeFile()” to write file to the path.
I found this at https://developer.android.com/work/managed-profiles#java but don’t know how to implement this in ionic 4.
So far I was using file URI everywhere. But after going through the above link I did following change to the code:
- When the user chose the file using file picker instead of calling “filePath.resolveNativePath()” which returns the file URI path I am creating blob object from the chosen file’s dataURI.
I don’t understand how to follow the android documentation to use the Content URI instead of file URI and move further .
Please help, Thank you.