8

I need to get a Google Packaged App to run at system startup. So, when the OS boots, it automatically loads my app.

Any way to do this in Google Chrome??

Thanks in advance.

Imme22009
  • 3,992
  • 7
  • 31
  • 47
  • On ChromeOS you can listen for http://developer.chrome.com/apps/app_runtime.html#event-onLaunched, which fires for every installed app when the user signs in. – sowbug Jul 28 '13 at 01:58

1 Answers1

14

If you literally want your app to start up "when the OS boots", then the answer is: You can't.

Otherwise, if it's OK if your app starts when the user logs in, add the "background" permission to your manifest file.

Permission "background"

Makes Chrome start up early and and shut down late, so that apps and extensions can have a longer life.

When any installed hosted app, packaged app, or extension has "background" permission, Chrome runs (invisibly) as soon as the user logs into their computer—before the user launches Chrome. The "background" permission also makes Chrome continue running (even after its last window is closed) until the user explicitly quits Chrome.

The "background" permission is only available for hosted apps, legacy packaged apps and extensions, not for Chrome apps.

If you want to use the "background" permission in a Chrome App, then the only way to do this is to get the extension whitelisted. This can be done using the --whitelisted-extension-id flag:

chromium --whitelisted-extension-id=[YOUREXTENSIONID - 32 chars a-p]

You can only have one extension whitelisted via the command-line, so this should only be used for testing. If you want to publish your app with the background permission, then you're out of luck. The permission was intentionally disabled by the Chromium team, see https://code.google.com/p/chromium/issues/detail?id=163770.

Community
  • 1
  • 1
Rob W
  • 341,306
  • 83
  • 791
  • 678
  • That's great, annoying that its not possible unless user logs in. But, for my purposes, this is more than enough. – Imme22009 Jul 26 '13 at 14:20
  • This doesn't seem to work for me. When I add that permission I get: "There were warnings when trying to install this extension: 'background' is only allowed for extensions, hosted apps, and legacy packaged apps, but this is a packaged app." – Jeffrey Basurto Jan 29 '14 at 08:57
  • @JeffreyBasurto I've updated my answer to clarify that "packaged app" means "legacy packaged app". I've also added a method to get the background permission for the Chrome Apps, it only works for personal use. – Rob W Jan 29 '14 at 09:19
  • Maybe at the time this answer, the next couldn't be done. On Mac, you can add a shortcut (right click on the app in Chrome Apps screen in Chrome browser, create shortcut). Then, call in a terminal "[ChromeAppLocation]/Contents/MacOS/app_mode_launcher". For example, in my case is something like this: /Users/admin/Applications/Chrome\ Apps.localized/Default\ knipolnnllmklapflnccelgolnpehhpl.app/Contents/MacOS/app_mode_loader – kanobius Oct 02 '15 at 20:56