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,
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.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
3 People are following this question.
Android App crashes suddenly after putting FPS TextMesh
Ads are not shown (GoogleMobileAds)
How to Load a URL? HELP
Need To Incorporate App Installation Access To `Identity`.