Native Client

Distributing Your Application

This document describes how to distribute Native Client applications through the Chrome Web Store (CWS). The Chrome Web Store allows you to upload applications for free, and distribute them for free or for payment. Before you upload your application to the Chrome Web Store, you must decide which distribution option you will use.

Distribution options

You can distribute your Native Client application as a hosted application, a packaged application, or an extension.

A hosted application is an application you host somewhere other than the Chrome Web Store (such as your own web server or Google App Engine).

A packaged application is bundled into one file hosted on the Chrome Web Store and downloaded to the user's machine.

An extension is an application designed to extend the functionality of the Chrome browser.

For Native Client applications, the main considerations when choosing the type of application to distribute are:

  • size: packaged apps and extensions are limited to 100 MB in size, while hosted applications do not have a size limit
  • hosting: you are responsible for hosting hosted applications (and associated costs), while the Chrome Web Store can host packaged applications
  • behavior: packaged applications can provide extensions behavior and enhance chrome, hosted applications cannot provide this behavior
  • execution: an extension is an application designed to extend the functionality of the Chrome browser

Refer to Choosing an App Type for further help choosing the type of application to distribute.

Depending on the distribution option you choose, proceed to Distributing a hosted application, Distributing a packaged application, or Distributing an extension.

Distributing a hosted application

A hosted application consists of three parts:

  • A Chrome Web Store manifest file (.json) and an icon uploaded to the Chrome Web Store. The manifest file points to the Native Client application, essentially a web site, hosted on your web server. The manifest file and the icon are put into a zip file for upload to the Chrome Web store. The zip file is then converted to special zip file with a .crx extension. Refer to the Chrome Web Store Tutorial: Getting Started or the Hosted Apps documentation for further information.
  • All the regular Native Client application files. These files are hosted on your web server or Google App Engine at a location pointed to by the .json manifest file.
  • Binary assets. These files are hosted on your web server, Google App Engine, or Data Storage for Developers.

Hosting options

Google offers a couple hosting options you might consider instead of your own:

  • Google App Engine allows developers to release their applications on the same platform used for Google web applications such Gmail. Refer to Google App Engine - Pricing and Features for pricing information.
  • Google Storage for Developers allows developers to store application data using Google's cloud services and is available for a fee-per-usage basis. Refer to Pricing and Support for pricing information.

Additional considerations for a hosted application

  • If you want to write data using the Pepper local file API, you must set the 'unlimitedStorage' permission in your Chrome Web Store's manifest file, just as you would for a JavaScript app using the HTML5 file API.
  • Make sure to mention that your application is a Native Client application that only works with the Chrome browser in your description on the Chrome Web Store. Also be sure to identify the version of Chrome your application requires.
  • Hosted and packaged applications have a "launch" parameter in the manifest. This parameter is present only in apps, and it tells Google Chrome what to show when a user starts an installed app. For example:
    "launch": {
      "web_url": "http://mail.google.com/mail/"
    }
  • You can place your application in the Google Web Store with access only to certain people for testing.

Distributing a packaged application

A packaged application is a special zip file (with a .crx extension) hosted in the Chrome Web Store. This file contains all of the application parts: A Chrome Web Store manifest file (.json), an icon, and all of the regular Native Client application files. Refer to Packaged Apps for information on creating a packaged application file.

Once you have a manifest file and an icon for your application, you can zip up all the files for your packaged application into one zip file for upload to the Chrome Web Store. Refer to step 5 of the Tutorial: Getting Started document to learn how to zip up your packaged application and load it into the Chrome Web Store.

Additional considerations for a packaged application

  • If you want to write data using the Pepper local file API, you must set the 'unlimitedStorage' permission in your Chrome Web Store’s manifest file, just as you would for a JavaScript app using the HTML5 file API.
  • Make sure to mention that your application is a Native Client application that only works with the Chrome browser in your description on the Chrome Web Store. Also be sure to identify the version of Chrome your application requires.
  • Hosted and packaged applications have a “launch” parameter in the manifest. This parameter is present only in apps, and it tells Google Chrome what to show when the user starts an installed app. For example:
    "launch": {
      "web_url": "http://mail.google.com/mail/"
    }
  • If you are using a packaged application, you must use in-app purchase.
  • You can place your application in the Google Web Store with access only to certain people for testing.

Distributing an extension

An extension consists of a special zip file (with a .crx extension) hosted in the Chrome Web Store containing all of the application parts: A Chrome Web Store manifest file (.json), an icon, the Native Client manifest file (.nmf), HTML file(s), and Native Client modules (.nexe). Refer to the Google Chrome Extensions Overview to learn how to create an extension.

Once you have a CWS manifest file and an icon for your application, you can zip up all the files for your packaged application into one zip file for upload to the Chrome Web Store. Refer to step 5 of the Tutorial: Getting Started document to learn how to zip up your extension and load it into the Chrome Web Store.

Registering Native Client modules to handle MIME types

If you want Chrome to use a Native Client module to display a particular type of content, you can associate the MIME type of that content with the Native Client module. Use the nacl_modules attribute in the Chrome Web Store manifest file to register a Native Client module as the handler for one or more specific MIME types. For example, the bold code in the snippet below registers a Native Client module as the content handler for the OpenOffice spreadsheet MIME type:

{
   "name": "Native Client OpenOffice Spreadsheet Viewer",
   "version": "0.1",
   "description": "Open OpenOffice spreadsheets, right in your browser.",
   "nacl_modules": [{
      "path": "OpenOfficeViewer.nmf",
      "mime_type": "application/vnd.oasis.opendocument.spreadsheet"
   }]
}

The value of "path" is the location of a Native Client manifest file (.nmf) within the application directory. For more information on Native Client manifest files, see Files in a Native Client application.

The value of "mime_type" is a specific MIME type that you want the Native Client module to handle. Each MIME type can be associated with only one .nmf file, but a single .nmf file might handle multiple MIME types. The following example shows an extension with two .nmf files that handle three MIME types.

{
   "name": "Spreadsheet Viewer",
   "version": "0.1",
   "description": "Open OpenOffice and Excel spreadsheets, right in your browser.",
   "nacl_modules": [{
     "path": "OpenOfficeViewer.nmf",
     "mime_type": "application/vnd.oasis.opendocument.spreadsheet"
   },
   {
      "path": "OpenOfficeViewer.nmf",
      "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template"
   },
   {
      "path": "ExcelViewer.nmf",
      "mime_type": "application/excel"
   }]
}

The nacl_modules attribute is optional—specify this attribute only if you want Chrome to use a Native Client module to display a particular type of content.

Using CWS inline install

Once you've published your app or extension, you may be wondering how users will find and install your app. For users who browse the Chrome Web Store and find your app, installing the app is a very simple one-click process. However, if a user is already on your site, it can be cumbersome for them to complete the installation—they would need to navigate away from your site to the store, complete the installation process, and then return to your site. To address this issue, you can initiate installation of apps and extensions "inline" from your site. The apps and extensions are still hosted in the Chrome Web Store, but users no longer have to leave your site to install them. See Using Inline Installation for information on how to use this feature.

Monetizing applications and extensions

Google provides three primary monetization options for Native Client applications: in-app payments, one-time charges, and subscriptions. Refer to Monetizing Your App to learn about these options. The Chrome Web Store Overview also has information on different approaches to charging for your app.

Authentication required

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

Signing you in...

Google Developers needs your permission to do that.