Question about Uploading Files to Firebase Storage

Can you send me the aia / test aia via PM?

My method works with spaces in the filename.

You can if you use SAF or the filepicker component
Taifun

but it works without using SAF, maybe the filepicker applies SAF internally ?

It also seems to work on Android 9 (without READ permission).

I can also pick the 1.pdf from the root dir of the external storage. This should never be possible on Android 11+ (also not with SAF). :upside_down_face:

It seems that Tim has found a loophole that Google URGENTLY needs to close with the next targetSdk 34 update. :wink: :grinning_face_with_smiling_eyes:

1 Like

Why do you think so?

According to Storage updates in Android 11  |  Android Developers we do not have access to the root directory itself, but we are able to pick files from any directory (i.e. also the root directory) except of /Android/data and /Android/obb

Taifun

Yes, but with SAF we can't select a file from the root dir because we don't have access to it. However, if we know the file name, we can also open it with SAF from the root dir.

I need to take a closer look at this... :thinking:

I've now done some tests with Companion and the APK. I can select non-media files (PDF, TXT, CSV,...) from any directory (even from the root dir of the external storage), then e.g. upload to Firebase, download from there to the ASD and then display, read, etc. these files. All of this works without storage permissions on all Android versions.

It doesn't matter whether I use the FilePicker component or the ActivityStarter (android.intent.action.PICK). Both work.

(Uploading and downloading only takes a few milliseconds for small text files; for larger PDF files it may take a few seconds, depending on the internet speed.)

Maybe this is an alternative for some who have difficulty with SAF or who absolutely need access to the root directory of the external storage and the /Download directory on Android 11+. Because these directories cannot be selected with SAF.

2 Likes

Addendum: Taifun was of course right that you can also open a single file from any directory with SAF (.OpenSingleDocument).

The advantage of SAF is that (since one of the last updates) you can declare the initialDir, e.g. the root dir or /Download is opened directly in order to be able to select a specific file.

1 Like

Hey, sorry for the disappearance regarding my question, but I managed to figure it out. I genuinely thank everyone for the help!

Please provide a screenshot of your working solution to help others with the same question in future

Taifun

You marked your post as a solution, but I don't see any solution there...

1 Like

The solution was based on the blocks that Anke and TIMAI2 provided me. My real mistake was that in my StorageAppID, there was a '/Arquivo/' because I wanted to send PDF files inside the 'Arquivo' folder. However, I still had an error related to the list, it was giving me the error below.

So, I did as follows in my solution below, it was sent, I also added a '%2F' to the join, which I noticed is how you create folders, and it worked fine. I will add more options, such as the user being able to send 5 PDFs at once, but this was enough for now. I appreciate everyone's help

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