Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload was not working in API level 32 in Android #356

Open
Tejesh-Kumar-tech opened this issue Dec 13, 2022 · 2 comments
Open

Upload was not working in API level 32 in Android #356

Tejesh-Kumar-tech opened this issue Dec 13, 2022 · 2 comments

Comments

@Tejesh-Kumar-tech
Copy link

image

Getting this error when we are trying to upload a file to server
Tried placing android:requestLegacyExternalStorage="true" , but no use

am using Ionic
image_2022_12_13T09_11_39_118Z

Please help if any one has solution for this

@hydrococcous
Copy link

hydrococcous commented Jan 24, 2023

I have the same problem here. As far as I could find out, it is necessary to set the following access in AndroidManifest.xml:

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

However, Google is very restrictive when it comes to this setting: More information here:
https://developer.android.com/training/data-storage/manage-all-files#all-files-access-google-play

In my specific case, I download files for editing. After I edited the file with another app, e.g. Word, I no longer have access to it and I get the same error you described above.

Have you found a solution?

Here is my Output from Logcat:

{"code":1,"source":"file:\/\/\/storage\/emulated\/0\/Documents\/xxx\/xxx\/2110--199705\/file.docx","target":"https:\/\/domain.com\/api\/write","body":"{\"_error\":{\"1\":{\"hl\":\"xxx \\\/ ApiService\",\"eMsg\":\"Funktion 'xxxxx' yyyyy.\",\"addInfo\":\"\",\"icon\":\"48\",\"Type\":6,\"errNo\":131045,\"Modul\":\"ApiService\",\"PID\":3404,\"Computer\":\"XXX\"}}}","http_status":400,"exception":"\/storage\/emulated\/0\/Documents\/xxx\/xxx\/2110--199705\/file.docx: open failed: EACCES (Permission denied)"} java.io.FileNotFoundException: /storage/emulated/0/Documents/xxx/xxx/2110--199705/file.docx: open failed: EACCES (Permission denied) at libcore.io.IoBridge.open(IoBridge.java:575) at java.io.FileInputStream.<init>(FileInputStream.java:160) at java.io.FileInputStream.<init>(FileInputStream.java:115) at org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:249) at org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:232) at org.apache.cordova.filetransfer.FileTransfer$1.run(FileTransfer.java:395) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:920) Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(ForwardingOs.java:567) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:273) at libcore.io.ForwardingOs.open(ForwardingOs.java:567) at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8442) at libcore.io.IoBridge.open(IoBridge.java:561) at java.io.FileInputStream.<init>(FileInputStream.java:160)  at java.io.FileInputStream.<init>(FileInputStream.java:115)  at org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:249)  at org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:232)  at org.apache.cordova.filetransfer.FileTransfer$1.run(FileTransfer.java:395)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)  at java.lang.Thread.run(Thread.java:920) 

@rolinger
Copy link

For anyone still needing a solution, see this post:

#339 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants