chrome.app.runtime

Description: Use the chrome.app.runtime API to manage the app lifecycle. The app runtime manages app installation, controls the event page, and can shut down the app at anytime.
Availability: Stable since Chrome 23.

Summary

Events
onLaunched
onRestarted

Events

onLaunched

Fired when an app is launched from the launcher.

addListener

chrome.app.runtime.onLaunched.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function(object launchData) {...};
object (optional) launchData
string (optional) id The ID of the file or URL handler that the app is being invoked with. Handler IDs are the top-level keys in the file_handlers and/or url_handlers dictionaries in the manifest.
array of object (optional) items The file entries for the onLaunched event triggered by a matching file handler in the file_handlers manifest key.

Properties of each object

FileEntry entry FileEntry for the file.
string type The MIME type of the file.
string (optional) url The URL for the onLaunched event triggered by a matching URL handler in the url_handlers manifest key.
string (optional) referrerUrl The referrer URL for the onLaunched event triggered by a matching URL handler in the url_handlers manifest key.
boolean (optional) isKioskSession Whether the app is being launched in a Chrome OS kiosk session.

onRestarted

Fired at Chrome startup to apps that were running when Chrome last shut down.

addListener

chrome.app.runtime.onRestarted.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function() {...};