How to save a PDF file from Google Drive to the Download folder؟
Android 11+
How to save a PDF file from Google Drive to the Download folder؟
Android 11+
Do you want your app to
If 1. above, will you use
a. the web component (by providing the link)
or
b. the webviewer (by selecting the file from google drive)
to download the file?
The "assets" folder you can see with the app running in companion is NOT available to your app when it is compiled.
Blocks to Download the File (adjust filename and file ID accordingly):
This is with filescope set to App in screen properties and File component.
On newer android versions, the file will be saved to your ASD.
Test with Android 8, and report back where the file is saved to. (I forget...)
Please confirm that the file was saved to your ASD also with Android 8 ?
The path you show in both images (the second one being for companion app) is to the ASD (<path>/files/
).
If this is the case, then all you then need to do is follow the guidance previously provided in this topic to copy the pdf file from your ASD to the Download directory, observing the permissions and filescope requirements.
Hello. Thanks. On Android 8 and 11 phones, it was correct that the PDF was copied to the download folder, but on Android 14, the copy does not take place.
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.
To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
Yes, Google provides more security on newer devices, so you can't see the ASD anymore, but the file still should be there
What do you get displayed in Label1?
The blocks look fine, assuming you have set the default file scope in the project properties to App
As test you also can display the result of the copy process in another label...
Taifun
hi thanks.This label is for testing to see the address of the copied file.
Yes I know
It would be interested to let us know, which value gets displayed
Taifun
So it looks like the file got downloaded successfully
Now check the default file scope and the return value of the Copy method
Taifun
file dont copied in android 14 but copied in android 8 and 11.
Try this one: exp_2a.aia (647.5 KB)
It should work on all Android versions with Companion & APK.
If you first test with Companion, remove arabic.pdf from /Download/ beforer testing with the APK and vice versa.
Hi, I haven't had access to a phone with Android 14 yet to check this code, but it seems that the code has nothing new, just a clock has been added that checks whether the file is in the download folder. Am I understanding correctly? Please help. Thanks.
I tested it on Android 11-15 and it works fine (Companion & APK). On Android < 11 you must request and grant WRITE
permission testing with the APK.