- Home /
Google Drive Plugin - full access from android device
Hello,
I'm using the "Google Drive for Unity3D plugin" from the forum. What I want to do is, that the user can upload a file with his browser on his pc to Google Drive. Then I want to download this file on an android tablet.
I think that means that the App needs full access to google drive. Therefore I added the scope "https://www.googleapis.com/auth/drive" in "GoogleDriveAuthorization.cs". In the Edtior everything works fine and I can download the uploaded files.
But on a real android device it doesn't work. The initialization/authorization works. It's also possible to upload and download a text file which has been created by the app (like in the sample code). But if I search for the other files, which have been uploaded with the browser, nothing is found.
My assumption is that my app hasn't got full access to Google Drive and beacause of this the files which haven't been created by the app, can't be found.
What do you think? How can I solve this?
Answer by Meinzelmaenchen · Aug 18, 2014 at 10:10 AM
I found a solution. Thanks to "midworld" for the help!
Android doesn't use web browser based method for authorization. You have to modify the plugin itself.
Go to the file "unity-googledrive / NativePlugins / Android / GoogleDrivePlugin / src / com / studio272 / googledriveplugin / GoogleDrivePlugin.java"
Here you can modify the permissions:
credential = GoogleAccountCredential.usingOAuth2(activity,
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.appdata");
Replace the new "googledriveplugin.jar" in "unity-googledrive / Assets / Plugins / Android" and it should work.
Maybe it helps, if some has the same problem :)
I tried what you described above but I am still having trouble getting all my files on Android. With logcat I was able to see that I was authenticated with the correct "https://www.googleapis.com/auth/drive.Drive@" scope, however it doesn't return any files. Any suggestions or help would be much appreciated.
Answer by JustARabbit · Jun 30, 2015 at 11:05 AM
Actually this definitely works. My problem was that my query string was too long. It was giving me correct a response without any of the files.