Search code examples
androidscopesharegoogle-drive-android-apiunauthorized

Android Google Drive Api share files across devices and accounts


I'am using the Google Drive Android API. My application is synchronizing files to a google drive folder. This is working properly.
Additionally, I want to share those folders and files with other users. Unfortunately from another device and account in the same app I can only access files/folders which I have picked through the Files/Folder pickers (see https://github.com/googledrive/android-demos/tree/master/app/src/main/java/com/google/android/gms/drive/sample/demo)

My GoogleApiClient is getting the scope: Drive.SCOPE_FILE. So description says:

Per-file access to files created or opened by the app

Since I am using the same app on another device with a different account shouldn't I be able to access those files? Btw with the same account on another device this is working.

Is there any other solution? I've already checked the REST API but I am afraid this would make the whole code much more complex.


Solution

  • For everyone who is interested in a solution:

    • I found no way to sync shared files with the google android native API. (besides the file picker)
    • In case you want to do so you have to use the google drive rest API.

    A little advantage for this solution. I think the java rest API is anyway much more suited for this kind of work. Code gets in that way much more readable.