Pick a file and download from Google Drive to app standard directory

Hi All,
I need to pick a file ( a gpx track ) and copy to the standard app directory.

No problem if the file is already on the device ( in download, for example ) getting an URI of type content: using activity starter, translating to file:/// and use TaifunFile extension. I need too that the source should be a Google Drive. I can get the URI (content) but no idea about how to download the file to ASD.
Somebody can help?
Thanks!

Not clear what it is you want to do:

From where ?

do you mean the ASD ? (and assume that the file - from Google Drive - is download to the Download directory)

Hi, the final scope is to let the user select a gpx file, to be copied to ASD and then uploaded to a web page. The gpx file should be in download but also in a Google Drive area. The file picker returns me a URI ( content: ) both for the file in Google Drive, but I don't know how to download this file, better if directly in ASD.

really ?

You need to show your relevant blocks, and any other information (drive files etc.)

Here the relevant blocks. All ok for files on the device, all ok up to get a URI from Google Drive.

Do you want to download file from app to your Download folder of the mobile phone?

What has this (mess) got to do with Google Drive files ?

What extensions are you using other than Taifun File ?

List out your intended workflow from beginning to end.

Relevant extension are TaifunFTP ( transfer file to server ) , StorageAccess ( permission issue) and TaifunFile.

The scope is to use GPX files from different origins (specific apps) and to trasfer to an external site for further elaborations and storage.

Workflow is: user select a file from mobile storage using activity starter and standard file manager. Google Drive is required for some source sharing method.
A URI was obtained. URI is converted in file: format .
File is copied to ASD, renamed following a specific convention using TaifunFile
Then file uploaded to server via TaifunFTP for format conversion and some data extraction.
Results visuakized as graph built on the server using WebViewer.

Issue is that all this works fime with files on the mobile device storage only. I didin't a way to use or maniulate URI coming from filemanager when file found is in GoogleDrive. The converted URI points an not existing file, use of the URI in conent: format ( I try using SAF extension ) fail in "not found".

OK, I understand now.

With a quick test, using SAF, I can get the contenturi of a file on Google Drive, but don't seem to be able to do anything with it. The SAF extension may not be able to cope with this ? (@vknow360) or I am missing something...

I would recommend that any such files on Google Drive should be "Anyone with the link".

Are gpx files essentially text files, e.g. can be read by a text editor like Notepad ?

I am able to read the content of a text file from google drive, which means I can then save this to ASD.

Yes, gpx are just text files.

1 Like

It works perfectly. Thanks!
On the fly, I tested also with dropbox and Onerive, but in these cases a download is needed, I think.

Works fine:

1 Like

Ah, I didn't take out the file:// :upside_down_face:

But did you try it with a Google Drive file ?

Yes, and why else would the path point to the cache in internal storage?

Since the app has full access to the cache (internal storage), you can copy the (non-media) file to any allowed location (Shared Folders, ASD, ...) even without SAF but with any of the file extensions.

Thanks. I suppose that this version works with Google Drive, but the previous using SAF will work for any files in other directory, correct?

Copy of Google Drive File (no reading)

image

Yes, the simple set of blocks I show in post #19, or the blocks in post #14, will work for any file that you are able to pick from the device.