To get started integrating with the Drive UI, you need to enable the Drive API within your app's Cloud Platform project and provide configuration details. This gives you access to the API as well as access to UI integration features.
Enable the Drive API
To interact with the Drive API, you need to enable the Drive API service for your app. You can do this in the Google API project for the app.
To enable the Drive API, complete these steps:
- Go to the Google API Console.
- Select a project.
- In the sidebar on the left, expand APIs & auth and select APIs.
- In the displayed list of available APIs, click the link for the Drive API and click Enable API.
- Within the Drive API page, select the Drive UI Integration tab and begin configuring how your app integrates with the Drive UI.
Configure your app's Drive UI integration
Configuring your app's Drive UI integration requires you to provide detailed developer information for your app. To begin configuring, navigate to the Drive UI Integration tab within the Drive API page.
Configuring the Drive UI integration requires a number of assets—text, images, or URLs that are used to control the appearence and behavior of your app within the Drive UI. The following sections describe how these assets are used.
At the top of the Drive UI Integration panel are fields where you can enter information describing your application.
The Application Name and Short Description fields are displayed to users in the Manage apps dialog in the Drive UI. The Long Description field can be used to describe your application in more detail.
Specify application and document icons to display in Google Drive. You must provide at least one Application icon. For the best quality, select icons in PNG format with a transparent background and select a properly-scaled icon for each size.
For more information on the requirements for these assets, see the Branding Guidelines.
In this section, you'll need to specify the Open URL for your app, and your preferences on how users create and open files with the app. Also, you can select from optional features like support for multiple file selection and Google doc import.
There are two important things to keep in mind for the Open URL:
- Make sure you give a fully qualified domain name for open URL,
localhostdoes not work.
- The URL must belong to you. After the app registration is complete, you must verify your ownership of this URL in order to create a G Suite Marketplace listing. For more information, see Site Verification
Open URLs may include the template variable placeholders:
||A comma-separated list of file IDs that are being opened.|
||A comma-separated list of file IDs that are being exported.|
||The profile ID that uniquely identifies the user.|
||The action being performed. Either:
If no template variables are used in the Open URL, a
state query parameter
is automatically appended. It contains a JSON encoded string of all the above
template variables. You may choose to use either the
state query parameter
or URL template variable substitution.
See Open Files for more information on handling file open actions.
Setting MIME types and file extensions
Specify the MIME types and file extensions your app can open. When entering these values, consider the following:
- Specify both MIME types and file extensions. There are cases where just one or the other is not sufficient.
- Make sure the MIME types you enter are standard, canonical types or Google MIME types, free of typos or misspellings.
- Consider carefully whether your app needs default or secondary status.
Default vs. Secondary status is related to opening files with your app
by default. Simply put, default types are the MIME types and file extensions you
really want your app to open by default (the user makes the final choice on
this). Secondary types are ones that your app can open. For example, an
image editor might need to list numerous secondary types to open (
jpg, and so on) but few default types, which might include only its native
format for layering and editing images.
When multiple installed apps are registered as the default type for a particular MIME type or file extension, the last-installed app acts as default until the user makes a specific selection.
You can control whether or not users can create new Drive files with your application by checking the Allow users to create new documents using this application option. If enabled, you must provide a New URL that users are redirected to when a user selects your application from the New menu in Drive. You can optionally fill in the Document Name field to provide a name for the type of document your application creates. This is displayed in the New menu in Drive.
Multiple file support
If your application supports opening multiple files in a single instance, you can check this option to enable multiple file support. Otherwise, each time a user opens a file a new instance of your application is spawned.
You can opt to import files and convert them into formats supported by your app. For more information, see Open and convert Google Docs in your app.
Mobile browser support
Select this option if your application can be used in a mobile browser.
Team Drives support
Select this option if your application can be used to create and open files in Team Drives, and move shortcut files into Team Drives.
After you have enabled the Drive API and filled out the Drive UI Integration tab, have users or a testing account install your app.