Access to added files

Hi

I have added files by uploading them in my application
When I try the program via the connection, the files appear in a folder called Assest in the connection program folder
But when I built the application, the files I added to the application did not appear, although the application size became larger!
How can I access the files that I added to the application? Do I use double slash to access?

When I was saving a text file for the first time it was asking for access permission
Now don't ask!

I made access permission and it was also denied to copy a text file!

Please I need to know why this message?

I've accepted Permission alrady

The main documentation has yet to be updated but you may want to see this:

1 Like

On Android 10+ you can no longer copy a file (e.g. from the assets) to the external storage outside of the

  • ASD or
  • shared storage

because WRITE permission does no longer exist on Android 10+ if the app is targeting Android 11 (API 30). And this is now the case with AI2 (since the nb187 release, yesterday).

So use the File component and try to copy the file to the shared storage:

Unfortunately, this only works with Companion and not with the compiled app (APK), as there are still some bugs and permission issues, as I already predicted:

1 Like

TIMAI2
Thanks

Anke
I use Android 10
I will try same your blocks

Anke

This works well

But when I put a subfolder it doesn't work
Like: DCIM/Facebook/...

why?

Here is a test aia: copyToSharedTest.aia (3.5 KB)
Try with Companion, it should work.
But if you change the text of TextBox from Download to Documents if will not work. Check it.

Then build the APK and try again (it will not work, you will get a permission error).

These are the permissions declared in the Manifest:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

So there is no way to request and grant READ / WRITE permissions, which by the way shouldn't be required here either.

1 Like

Non-media files (like .txt) can only be copied / saved in these (shared) folders:

  • /Download
  • /Documents

But currently /Documents doesn't work.
(It should work and it works with Niotron.)
So we have to wait for this bug fix as well.

1 Like

Anke
thank you very much

Will I be able to copy to a private folder in the future?
How long will I wait for the problem to be fixed?

Because my program will be suspended for the time being
Although my previous project I created two days ago is working fine and I can copy using TaifunFile Extension

with all respect

Yes, with targetSdk = 29 TaifunFile works. With targetSdk = 30 TaifunFile will only work

  • for devices with Android < 10 and if
  • WRITE_EXTERNAL_STORAGE is declared in the Manifest and
  • WRITE permission is requested (manually).
1 Like

Anke
The users of my project are users
android 10 and less
Because my program is an improvement for some old devices

And the folder I want to copy some files to is Android/data/....etc.

So does this mean that there is absolutely no solution? Even in the future?
If there is a solution, what is it?

:frowning_face: :frowning_face: :frowning_face: :frowning_face:

Hi Taifun

Sorry but I need your help in this post

I use android 10 and my users also 10

starting with SDK30 you have to use the file component to copy files to the shared storage...

you will not be able to access application specific directories of other apps anymore...
and no, there is no solution... this is the future... :wink:
see also Evan’s blog from last year
https://appinventor-mit-edu.ezproxy.canberra.edu.au/blogs/evan/2020/08/08/file-path-updates-android-10

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

How can I use file component?
if I use DB ?Can I?

see here

but it seems to be, there are still some bugs around...

I do not understand... you might want to elaborate...

Taifun

1 Like

I mean if I upload a file on DB and using CloudDB to download the file
could I save the file from DB to any Folder in Sdcard? such as system files?

no you can't
you only can store to the ASD and shared storage
Taifun

1 Like

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