Google Drive SDK

Create a Chrome Web Store Listing

You can showcase your app among the growing list of Drive-powered apps available in the Chrome Web Store. A presence in the Chrome web store gives you free access to Chrome Web Store features for installing, distributing, and marketing web apps. Creating a Chrome Web Store listing and registering the file types it can open also allows your application to be listed as a suggested app in Gmail when a user receives an attachment your application can open, as shown below.

Suggested applications from Gmail

If a user doesn't see the application they want, the Connect more apps option allows them to discovery and connect with any compatible app.

In cases where the user has not installed a valid viewer for a file, and the Google Drive viewer can’t render the file either, Drive displays a link to a Chrome Web Store list of apps that can open that file type (if any). This can be a powerful mechanism for distributing your app to the users that actually need it.

To start leveraging those features, you'll need to create a listing for your app and register the file types it can open. You should only do this once your integration is complete and you're ready to let users know about it.

Set up a listing for your app in the Chrome Web Store

To get started setting up a listing, work through the instructions in the Chrome Web Store Getting Started Tutorial along with the Drive-specific instructions below.

Modify the listing's manifest for your Drive app

All Chrome Web Store apps — and Drive apps — require a JSON-formatted file named manifest.json that describes the app. In the manifest file for your Drive app, make sure to set the container value to GOOGLE_DRIVE and add the app ID shown in the Developers Console for your app.

  {
    "name" : "app_name",
    "version" : "version",
    "manifest_version" : 2,
    "description" : "description_text",
    "container" : "GOOGLE_DRIVE",
    "api_console_project_id" : "YOUR_APP_ID",
    "gdrive_mime_types": {
      "http://drive.google.com/intents/opendrivedoc": [
        {
          "type": ["image/png", "image/jpeg", "image/gif", "application/vnd.google.drive.ext-type.png",
          "application/vnd.google.drive.ext-type.jpg","application/vnd.google.drive.ext-type.gif"],
          "href": "http://your_web_url/",
          "title" : "Open",
          "disposition" : "window"
        }
      ]
    },
    "icons": {
      "128": "icon_128.png"
    },
    "app" : {
      "launch" : {
      "web_url" : "http://yoursite.com"
      }
    }
  }
 

The web_url value sets the location to redirect users to when your app is launched from the Chrome "New Tab" page or the "Launch App" button in Chrome Web Store. Keep in mind that the target of web_url should perform a valid action, like directing new users through authorization, opening an existing file, or displaying a static page announcing the new features of a Drive integration.

Entering file extensions in the manifest

The recommended best practice for Drive is to register both MIME types and file extensions. Though the type field accepts only MIME types, it allows you to model file extensions as the following special type:

application/vnd.google.drive.ext-type.<EXTENSION>

As shown in the example above, you can append extensions such as .png, .jpg, or .gif to this special extension. You can append any valid extension this way to make it discoverable by the search filter.

The important parts of the manifest to modify are the type and href field:

  • In the type field, enter the MIME types and extensions you'd like your app to be searchable by. Make sure to wrap each type in quotes and separate multiple types with commas as shown.
  • In the href field, enter the same URL you provided in the manifest for web_url.

If you already have an existing Chrome app in the store, adding these lines to the manifest at publication time will allow your existing users to open and create files from Drive and use all the Drive-specific functionality you have added to the new version of your app. Your users will see a notification the next time they load Google Drive.

Create a URL to test the listing

After you have modified your app manifest and added a list of MIME types and extensions, you can test it with a URL similar to the link displayed by the Google Drive UI. The key URL parameters to use, as supported by Chrome Web Store, are:

  • _wi The name of a web intent — always http://drive.google.com/intents/opendrivedoc
  • _mt A mime type, which can include the special extension-modeling application/vnd.google.drive.ext-type.<EXTENSION> type. This parameter may be specified multiple times. Multiple _mt parameters in a URL are handled with OR logic.

If you generate the URL in your code, make sure to URL-encode these parameter values. To test a search for .jpg files, the URL would look like this:

https://chrome.google.com/webstore/category/collection/drive_apps?_wi=http%3A%2F%2Fdrive.google.com
%2Fintents%2Fopendrivedoc&_mt=image%2Fjpeg&_mt=application%2Fvnd.google.drive.ext-type.jpg

If your app does not appear in the search results, check for the following:

  • Is the modified app configuration published?
  • Is the web intents parameter correctly specified as _wi=http%3A%2F%2Fdrive.google.com %2Fintents%2Fopendrivedoc?
  • Have you given canonical types with no typos in the _mt parameters?

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.