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.
Types
EmbedRequest
Properties
- 
    dataany optional Optional developer specified data that the app to be embedded can use when making an embedding decision. 
- 
    embedderIdstring 
- 
    allowvoid Allows embedderIdto embed this app in an <appview> element. Theurlspecifies the content to embed.The allowfunction looks like:(url: string) => {...} - 
    urlstring 
 
- 
    
- 
    denyvoid Prevents embedderIdfrom embedding this app in an <appview> element.The denyfunction looks like:() => {...}
LaunchData
Properties
- 
    idstring optional 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_handlersand/orurl_handlersdictionaries in the manifest.
- 
    isKioskSessionboolean optional Whether the app is being launched in a Chrome OS kiosk session. 
- 
    isPublicSessionboolean optional Chrome 47+Whether the app is being launched in a Chrome OS public session. 
- 
    itemsLaunchItem[] optional The file entries for the onLaunchedevent triggered by a matching file handler in thefile_handlersmanifest key.
- 
    referrerUrlstring optional The referrer URL for the onLaunchedevent triggered by a matching URL handler in theurl_handlersmanifest key.
- 
    sourceLaunchSource optional Where the app is launched from. 
- 
    urlstring optional The URL for the onLaunchedevent triggered by a matching URL handler in theurl_handlersmanifest key.
LaunchItem
Properties
- 
    entryEntry Entry for the item. 
- 
    typestring optional The MIME type of the file. 
LaunchSource
Enumeration of app launch sources. This should be kept in sync with AppLaunchSource in components/services/app_service/public/mojom/types.mojom, and GetLaunchSourceEnum() in extensions/browser/api/app_runtime/app_runtime_api.cc. Note the enumeration is used in UMA histogram so entries should not be re-ordered or removed.
Enum
"untracked"  "app_launcher"  "new_tab_page"  "reload"  "restart"  "load_and_launch"  "command_line"  "file_handler"  "url_handler"  "system_tray"  "about_page"  "keyboard"  "extensions_page"  "management_api"  "ephemeral_app"  "background"  "kiosk"  "chrome_internal"  "test"  "installed_notification"  "context_menu"  "arc"  "intent_url"  "app_home_page"  "focus_mode"  "sparky" 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Events
onEmbedRequested
chrome.app.runtime.onEmbedRequested.addListener(
callback: function,
)
Fired when an embedding app requests to embed this app. This event is only available on dev channel with the flag --enable-app-view.
Parameters
- 
    callbackfunction The callbackparameter looks like:(request: EmbedRequest) => void - 
    request
 
- 
    
onLaunched
chrome.app.runtime.onLaunched.addListener(
callback: function,
)
Fired when an app is launched from the launcher.
Parameters
- 
    callbackfunction The callbackparameter looks like:(launchData?: LaunchData) => void - 
    launchDataLaunchData optional 
 
- 
    
onRestarted
chrome.app.runtime.onRestarted.addListener(
callback: function,
)
Fired at Chrome startup to apps that were running when Chrome last shut down, or when apps have been requested to restart from their previous state for other reasons (e.g. when the user revokes access to an app's retained files the runtime will restart the app). In these situations if apps do not have an onRestarted handler they will be sent an onLaunched event instead.
Parameters
- 
    callbackfunction The callbackparameter looks like:() => void