Assign tray icon to Google Chrome web application - google-chrome

I need to create a web application which will be stored in the traybar of Windows, this to prevent users from accidentally close my application (without the need of a pre-close alert message).
I thought that Google Chrome's background apps could be the right way to go, mostly because I don't need cross-browser compatibility and I have to choose which browser my users will use to run this web application.
The only problem is that I don't understand if I can achieve what I need with this feature.
I've found only this example of background app in Chrome countdown app
But this app uses the "background page" feature, that is different from what I'm looking for.
How can I let a Chrome app be minimized in the traybar (or even in the taskbar would be ok) instead of be closed?

Try to use node-webkit (chromium + node.js) for it: https://github.com/rogerwang/node-webkit
It allow to create any web-app and it support tray icons: https://github.com/rogerwang/node-webkit/wiki/Tray
You can download my windows example app here: https://mega.co.nz/#!xQMzgbxD!S58G-V23QLNRDFC10xso41-T2V8OZQVsQEH-lr46R3s
If you want exactly chrome, try this NPAPI plugin example: http://minimizetotray.googlecode.com/files/SourceCode.zip from http://habrahabr.ru/post/73003/

Unfortunately, I don't think you will be able to achieve exactly what you're after. You might be able to combine the two solutions below to nearly achieve your requirements. However, I don't think the type of control you are after is available via Google Apps.
Google App Launcher
The Google App Launcher would fulfill the "stored in the traybar of Windows" requirement.
The Chrome App Launcher is the hub of all your Chrome apps and with it
you have quick access to all of your apps from the desktop. When you
install an app from the "For Your Desktop" collection of the Chrome
Web Store, you get the App Launcher. The App Launcher requires you to
sign in to Chrome to enable apps that need access to your Google
account.
Manage apps
When you download a new app that enables App Launcher, the apps from
your Apps bookmark on Chrome New Tab page will also appear in the App
Launcher. Managing apps in the App Launcher is simple.
Add more apps: Click the Chrome Web Store button in your apps list and explore the apps in the store.
...
Background: Extending Your App's Life
You mentioned background apps in your question but I would recommend you explore it further. It essentially provides the "prevent users from accidentally close my application" requirement that you stated. This isn't foolproof (see bold sentence below) but it is about as close to the requirement I think you will be able to achieve.
As of Google Chrome 10, the background feature lets a hosted app run
as soon as the user logs into their computer—before the user launches
Chrome or the app—and to continue running even when Chrome or the app
has no visible windows. However, if the user explicitly quits Chrome,
the browser and app both exit.

Related

Full Website Within Chrome Application Window

Was wondering if I had a web-application on www.mydomain.com/userportal etc but didn't want this accessable via the browser, but as a chrome application similar to how Google's Hangouts is a seperate window / popup - How easy is it to implement an already built application into one of these windows?
If I understand you correctly, you would like to display your www site as a Chrome App. Chrome apps are all HTML/CSS/JS files hosted on the computer but they can display a webview into a site online. However, Chrome Apps must be 'offline' first. So you must ask for permissions to all online activity.
Ideally you would make separate app hosted as a Chrome App (not link/embedded to a www site) that uses an API to talk to a web-app.
Keep in mind that Google is phasing out Chrome Apps for all platforms except Chrome OS in the near future.

chrome.management functionality in apps?

I'm new to making chrome apps and extensions, working on my first app. I need access to alist of the installed apps on chrome with their relevant details and icon, so I used chrome.management. However, when I try to use it in my app, I get the error
'management' is only allowed for extensions and legacy packaged apps,
but this is a packaged app.
Looking at the api page, chrome.management is indeed not listed under the "Apps" tab, but the "Extensions" one.
Is there any other way I can have access to the information in an app? Chrome app launcher did it... not sure if there were any super secret special permissions involved.

Chrome extension or chrome app?

I would like to create an extension or app for the Chrome browser which would require access to a user's Google Calender (for creating new appointments).
I am unsure of which technology to better research and use, Chrome extensions or apps. My "app" wouldn't need much of a GUI, so I'm leaning towards extension — but I don't know if this would pose any difficulties for accessing a user's Google Calender to add an event.
Anyone one have any idea which technology is best for this situation, and why? Thanks!
Either, or... Go with an extension if you'd like.
I assume you've looked at the API reference?
https://developers.google.com/google-apps/calendar/
From there, I'd imagine you'd just need OAuth to authenticate the user. Here's the JS library:
https://code.google.com/p/google-api-javascript-client/
There are pros/cons of each types, apps or extensions.
Apps
If you would like to create a client application of Google Calendar which has many rich GUI components, this type will become a better solution.
In addition, Chrome apps can communicate with many hardware devices and other servers. Of course, your Chrome app can become as a server (that is, your app can open a server socket and accept a request from other client apps).
Chrome apps can be executed not depending on your Chrome Web browser. That is, Chrome apps cannot access to a context of your Chrome Web browser.
Probably, you don't want to get the pros above, I guess...
Extensions
If you would like to create a small UI for posting your schedule to Google Calendar, this type will become a better solution.
In addition, Chrome extensions can access to a context of your Chrome Web browser. That is, your extension can get page contents of each tab and inject your CSS and/or JS code. For example, your extension will get a URL of some opened tab and include it in a body of the posted schedule.
Chrome extensions completely depend on your Chrome Web browser. That is, your extension cannot execute independently.
Also, generally, high cost will be needed to develop Chrome apps than Chrome extensions. As the result, you should choose Chrome extensions, I believe.

Can you still create a Chrome packaged app in the browser with manifest 2.0?

All of the examples I've seen show apps launching in their own windows. This may be great an all for chromebook/chrome os, but is there still an option to launch in a browser tab?
No, there is no way to do that. Chrome Packaged Apps are not supposed to run inside a browser. You can, however, open URLs in a browser tab using window.open. But you won't have control of that tab after you issue the command.
If you need some sort of integration/control between your Chrome Packaged App and the browser, you can create an extension and make a communication pipe between the extension and the app - as long as both are running, using the chrome.runtime.sendMessage API.
See this sample for a simple code that does exactly that (two apps and one extension exchanging messages directly, without any server component).
chrome.app.window.create will create a new Window for an App.
If you want window manipulation, you should switch to chrome.tabs API and look for an extension instead of an App.
Reference
chrome.tabs
chrome.app.window

Chrome Packaged Background App Functionality & Behavior

We are exploring the inviting Chrome Packaged Apps for developing our HTML5 based Offline Web-Application and for that, chrome's background apps feature is quite interesting and complies to our requirements. However, i have the following query:
1. Will the app continue to run in the background if the user has closed the Chrome Browser window? Actually I want to sync my data to an online server and want it to keep running even if the user has closed the browser window.
Can anyone guide is this feature possible in Chrome's packaged background apps?
You can use one of the following technologies in Chrome Packaged Apps:
Alerts API: it allows you to schedule periodic runs of a specific piece of code
Cloud Service and PushMessaging API: although in experimental state, this API will allow your Chrome App to receive notifications from an third-party, for example your own server. This is, however, not appropriate for broadcasts, as each pushmessage goes to one app and one user per time.