ENVIRONMENT:
I have a system consisting of Android clients and Linux server. Files (jpeg images) are transferred from Android client to Linux server via Google drive OK.
I have this transfer working well.
Later the server needs to send the file (jpeg) to other clients based on search criteria, location, the view area, etc. So I try to reverse the flow to transfer the jpeg file to clients.
The app and ServiceAccount are both associated with the application in the developer's console.
The email associated with the App and ServiceAccount are different domains. (This is not Google Apps for Work.)
PROBLEM: Since the newer Android Drive API with Google Play Services only supports Drive.SCOPE_FILE the app does not have access to files created by Service Account on Linux.
Is it possible on the server using REST API to add/change ownership of the file so the client can read the file with Drive?SCOPE_FILE? My attempts on this path so far have failed. Trying to insert new ownership fails with a status saying it's not yet implemented. Updating permissions to provide the app with ownership reports insufficient permissions for this file. Trying to patch the permissions give similar failure message. However, I am new to this API and may be doing it wrong.
Is it possible to access the contents of the file using Android DownloadManager service? The best I have done with this path, trying multiple variations of links, is an HTML file which looks appropriate for browser parsing and display: not the contents of the jpeg file. Again, this is a new area for me and I may not be doing it right.
From my research, it appears I can do what I need to do by using the REST API on the Android client, but I really don't want to incur that overhead if there's another path.
At a high level, the documentation (as sparse as it is) implies what I want to do possible. Does anyone have experience with this data flow pattern? If so, what's the appropriate way for the client to read the file created by the Service Account on the Server?
Thanks in advance!
After a few more days of exploring various rabbit holes I was able to download the file using Android DownloadManger. The trick was composing the correct query parameters in the HTTP request URI:
https://drive.google.com/uc?export=download&id=[resourceId]
Also the google drive file resource security needs to be 'public' or 'anyone with link' for this to work.