-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the Simple Google Drive wiki!
The asset consists of 2 parts: Google Sign-in and use of Google Drive API. So let's start!
- Cross-platform (Android, iOS, macOS, Windows, UWP, WebGL)
- Simple and flexible code
- Easy to learn with a lot of examples
- 2-way folder synchronization implemented
- Supports both
drive
anddrive.appdata
scopes - No native plugins and 3rd party libraries
- Active support
- Simple and fast integration to your project
- Simple and flexible code (easy to learn, modify and extend)
- More examples, including folder synchronization
- Simple authorization witn Simple Google Sign-In
- Better performance (caching + less calls to API for most scenarios)
- Better error handling
- Better security with AES encryption of sensitive data
- SFSafariViewController implemented for iOS (required by App Store review)
- Universal Windows Platform (UWP) support and better WebGL support
- No native plugins and 3rd party libs
- Less build size
- Strong C# knowledge
- LINQ basics
- JSON basics (Newtonsoft.Json)
- Async programming basics
- Understanding Google Drive API
- Google Drive does NOT behave like your local file system! File and folder names need not be unique, even at a given level of the hierarchy. This means that a single path can describe multiple files.
- Google Drive operates with entities called
File
. This can be a file, a folder or a Google Workspace document (Google Docs, Sheets, and Slides). Each file has a MIME type. For example, folders are files with MIME typeapplication/vnd.google-apps.folder
and Google Sheets have MIME typeapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
. - Google Drive has a hierarchical structure where each file has a parent, and the root folder is
My Drive
with IDroot
(orApp Folder
with IDappDataFolder
). - Google Drive API doesn't support paths as we used to work with in Android or Windows, so we have to implement path resolving by iterating through parents and childs (if we want to operate with paths, of course).
- Google Drive file names are case sensitive, unlike File System names for most platforms.
You need to purchase and import Simple Google Sign-In and follow setup steps described in Wiki. IMPORTANT! Add Google Drive API access scope on Google Cloud > APIs & Services > OAuth consent screen
. After obtaining a valid access token you can start using Google Drive API.
-
https://www.googleapis.com/auth/drive.appdata
(preferred) allows to work with the app folder only. This is a non-sensitive scope and your app doesn't require to be validated by Google. The application data folder is a special hidden folder that your app can use to store application-specific data, such as configuration files. The application data folder is automatically created when you attempt to create a file in it. Use this folder to store any files that the user shouldn't directly interact with. This folder is only accessible by your application and its contents are hidden from the user and from other Drive apps. The root isApp Folder
with IDappDataFolder
. With this scope, you can't work withTrash
or other locations except the app folder. More info: Store application-specific data. -
https://www.googleapis.com/auth/drive.file
allows your app to create new Drive files, or modify existing files, that you open with an app or that the user shares with an app while using the Google Picker API or the app's file picker. This is a non-sensitive scope and your app doesn't require to be validated by Google. Your app can't access existing user files that were created by user manually or by other apps. Also it can't access the root folderMy Drive
. Files created with this scope can be accessed both with Google Drive API and Google Drive clients (web/mobile/standalone). -
https://www.googleapis.com/auth/drive
allows to see, edit, create, and delete all Google Drive files avaialble for the current user. This is a restricted scope, so your app should be validated by Google (Google Cloud > APIs & Services > OAuth consent screen
). The root folder isMy Drive
with IDroot
.
Notes. Use https://www.googleapis.com/auth/drive.appdata
for most cases. Use https://www.googleapis.com/auth/drive.file
if you want to make your app files visible with Google Drive clients (web/mobile/standalone). Avoid using https://www.googleapis.com/auth/drive
if it's not primary functionality of your app (or get ready for complicated validation by Google).
- You've imported BOTH assets: Simple Google Sign-In and Simple Google Drive.
- You've created Google credentials with Google Drive API scope.
- You've changed credentials in
SimpleGoogleDrive/Resources/GoogleAuthSettings
. - You can sign in with Google and obtain an access token (press
Sign in
in theExamples
scene). You may see the warningThis app isn't verified
when signing in to Google, it's because your app uses a restricted scope and wasn't reviewed by Google. It's ok, just pressAdvanced
to continue.
Your entry point is GoogleDrive
class. It contains core functions to work with Google Drive API. GoogleDriveExtensions
provides extra methods that can't be related to core functions. The asset includes examples for all basic actions, just refer to Examples
scene and scripts inside the Examples
folder.
- Write a review on the Asset Store =)
- Remove debug logs with sensitive data (like access tokens), set
GoogleDrive.DebugLog = false
- Add new functions by extending
GoogleDrive
andGoogleDriveExtensions
(or contact me for updating/extending the asset) - Send your app for review if you use the restricted scope
https://www.googleapis.com/auth/drive
. It's not so easy as you may think, so be patient.