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

How to access files in android sdk 30 #502

Closed
danicarla opened this issue Nov 10, 2021 · 7 comments
Closed

How to access files in android sdk 30 #502

danicarla opened this issue Nov 10, 2021 · 7 comments

Comments

@danicarla
Copy link

danicarla commented Nov 10, 2021

HI guys...

I found the archives this way:

///storage/emulated/0/Android/data/myappid/files/
///storage/emulated/0/Android/data/myappid/cache/

And now which path should I use?

@breautek
Copy link
Contributor

See Where to Store Files

Generally speaking, I'd advise against using the cordova.file.external* paths (which all translate to /storage/emulated/0/ on android, unless you have a really good reason to use them. External paths are very restrictive, especially as of API 29.

If you're storing app files, the recommended path would be cordova.file.dataDirectory

@danicarla
Copy link
Author

My application downloads some images and previously i chose the directory that stored these images
Now I'm not specifying a directory, I'm just putting "cordova.file.dataDirectory" and the download is done successfully.

I can even see that the size of the app has increased, but I can't access these images
Which path should i use to access these images?

In https://github.com/apache/cordova-plugin-file#where-to-store-files say to use <img src="file:///android_asset/files/teste.jpg" width="70%"> but dont work

@clarklight
Copy link

clarklight commented Jan 7, 2022

I am also having the same issue with cordova.file.dataDirectory, when i try to use the nativeURL within the fileEntry response to reference into a src tag for an , it will give the not allowed to load local resources error.

@danicarla
Copy link
Author

@clarklight Did you find any solution?

@clarklight
Copy link

@danicarla take a look at this thread, see if it helps. #509 (comment)

People in that thread seems to have similar issues and found a solution, but i did a work around with turning the image into base64 for display.

@danicarla
Copy link
Author

@clarklight I don't think I can do that, my app uses more than 20,000 images :(

@breautek
Copy link
Contributor

If you're trying to load stored images into dom, then

#517 may help, available in the latest file plugin release.

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