Fri, 08 Oct 2021 08:21:11 GMT
Join the conversation at slack.cordova.io
Thu, 07 Oct 2021 17:02:40 GMT
@dpogue says
FYI npm is having issues today: https://status.npmjs.org/
Thu, 07 Oct 2021 12:29:31 GMT
@jakob.pfab says
Hi!
After upgrading to Android target sdk 30 i can not load any images that i downloaded with to LocalFileSystem.PERSISTENT (the urls start with file:///data/user/0/com.company.app/files/files/ and i get ERR_ACCESS_DENIED)
If i set setAllowFileAccess(true) in CordovaActivity.java it works again.
Is there any other solution to load those images into the WebView that does not require to modify the Cordova Lib files?
Thu, 07 Oct 2021 12:40:46 GMT
@erisu says
<preference name="AndroidInsecureFileModeEnabled" value="true" />
Thu, 07 Oct 2021 13:00:20 GMT
@jakob.pfab says
Thanks!
I think this only works in cordova android 10 and i could not update yet because of some plugins... I will set it manually then, until i can upgrade to 10 i guess...
Thu, 07 Oct 2021 13:03:30 GMT
@jakob.pfab says
Another solution to access files downloaded to the internal storage would be nice, but i could not figure out how so far
Thu, 07 Oct 2021 13:07:00 GMT
@norman137 says
Normally you would use cordova-plugin-file to read/write to the application's internal storage files
Thu, 07 Oct 2021 13:07:30 GMT
@norman137 says
You can read files as a blob and create an object url for it to be used in the dom as well
Thu, 07 Oct 2021 13:07:37 GMT
@jakob.pfab says
yes i use it to store the downloaded files
Thu, 07 Oct 2021 13:07:38 GMT
@norman137 says
Useful for things like images
Thu, 07 Oct 2021 13:10:26 GMT
@jakob.pfab says
i have a lot of images/videos/audios
Thu, 07 Oct 2021 13:10:52 GMT
@jakob.pfab says
i read somewhere adding those as blob could lead to memory leaks?
Thu, 07 Oct 2021 13:13:57 GMT
@norman137 says
you‘re suppose to revoke them once you’re done using the urls
Thu, 07 Oct 2021 13:14:20 GMT
@norman137 says
Otherwise the webview will retain a reference to that resource in memory
Thu, 07 Oct 2021 13:14:29 GMT
@norman137 says
for as long as the object url is “alive”
Thu, 07 Oct 2021 13:14:45 GMT
@jakob.pfab says
good to know
Thu, 07 Oct 2021 13:15:23 GMT
@norman137 says
https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
Thu, 07 Oct 2021 13:15:34 GMT
@jakob.pfab says
i think i found an easier solution though :simple_smile:
Thu, 07 Oct 2021 13:15:54 GMT
@jakob.pfab says
if i use toInternalURL instead of toURL
Thu, 07 Oct 2021 13:17:14 GMT
@jakob.pfab says
it gives me URLs like cdvfile://localhost/persistent/...
Thu, 07 Oct 2021 13:17:45 GMT
@jakob.pfab says
those seem to work without
setAllowFileAccess(true)
Thu, 07 Oct 2021 13:23:36 GMT
@norman137 says
is the phone done charging?
Thu, 07 Oct 2021 13:24:04 GMT
@norman137 says
oops
Thu, 07 Oct 2021 13:24:05 GMT
@jakob.pfab says
what phone 😆
Thu, 07 Oct 2021 13:24:07 GMT
@norman137 says
wrong slakc channel
Thu, 07 Oct 2021 13:24:09 GMT
@norman137 says
😆