Copy files from ASD to Shared Storage

Hello there,

Right now I am really stuck on my project targeting newer SDK versions with scoped storage. I have searched and read the community’s posts but still not having a proper outcome when implementing them on my project.

These are the examples that returns “File not found or sharing” or “Error 2001” or the error “storage/emulated/o/…”


How do I solve this problem for newer android devices? (I am using older devices and these blocks still work, while it is not working on my Android 12 phone)

Thank you in advance.
Hope you stay safe and healthy!

Assets are not stored in asd in apk. That path is only for companion.

You do not need complicated if then else statements to copy a file from the assets to somewhere, just use // together with the filename, the rest will do the extension for you

You forgot to copy to shared storage… you can’t copy to arbitrary directories anymore… just try to copy to /Downloads/yourDirectory instead…

Taifun

Hello again, Taifun.

Thank you for the response.
I have tried this now.

It successfully copying the file but it still cannot share it.
The sharing options pop up on screen asking me where to share, but when I share it, the corresponding app (e.g. WhatsApp, Gmail for me to share the file) implies the file cannot be accessed or sharing failed.

What could I go wrong?

Thank you.
Stay safe and healthy

1 Like

Try to call share block one about 100ms after the copy block (use a clock for this). May be the file was not copied when you try to share it.

If it doesn’t work, show the error message exactly as it appears.

1 Like

Hello there,
Thank you for the response. But, it seems that I have found the workaround.

I tried to use the native sharing component instead of the extension one, and it works.

Cheers.

Your copy blocks will work only in the companion app
As already mentioned earlier

Taifun

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.