Chrome App using sockets api run without opening Chrome window - google-chrome

I want to build a Chrome App to listen notifications sent by my Lab, and I don't want to open a Chrome window(just let the app run in background silently, and pop a box when I have a new message). But sockets api is only for packaged app, and packaged app has no background permission, what should I do? Thx.

(Quick answer, will edit later with more info.)
Chrome Packaged Apps don't need that permission, they have a background page by default. Most (say, 99% of existing) chrome apps will open a window when they launch, but thats optional.
If your app has an open window, the runtime will keep your application running an not move into an idle state. However, if you are using certain APIs, such as having an open TCP server socket listening for incoming connections, its very unlikely that the runtime will shut your app down unless the system is under serious constraints.

Related

chrome.enterprise.deviceAttributes availability for force-installed PWAs in chrome enterprise

I'm trying to determine if I can access any browser api for chrome OS that will allow me to identify the device that its running on when the application has been force-installed in kiosk mode as a PWA.
We're running into exactly the same issue right now. The correct path seems to be to create a PWA and to connect it to a (pre-installed) extension that has access to the enterprise.deviceAttributes:
See https://developers.chrome.com/apps/migration:
"If there is a capability that your Chrome App has that the regular web platform can't provide, it might be available as an extension API. In this case, you use a progressive web app together with an externally connectable extension your web app can send messages to."
enterprise.deviceAttributes are only accessible if the calling App/Site is pre-installed to the device and not loaded dynamically, so it cannot run in the PWA by design.
But with this tutorial, it seems possible:
https://developer.chrome.com/extensions/messaging#external-webpage
We're looking into that right now and will post our progess here.

Developing a Chrome Kiosk App on a non-managed Chromebox

tl;dr I want to use an API that only works for Chrome Kiosk Apps. How can I run my app locally as a kiosk app such that I can access these APIs?
Hey All,
I am trying to develop an application that uses the chrome.audio API. Though the docs do not say so, upon loading an unpacked app on my Chromebox I get a warning saying "'audio' is only allowed to run in kiosk apps sessions, but this is a regular user session."
So I began trying to get the app launched in kiosk mode. I have modified the manifest.json file to claim kiosk mode: "kiosk_enabled":true. I navigate to chrome://extensions and click "Manage Kiosk Applications" but when I put in the app ID provided when loading my unpacked extension, I always get a message saying "Invalid App ID".
It has been suggested to me that the only way to load a kiosk app is either through the admin console (not applicable to me since my device is unmanaged) or by publishing the app to the Chrome Web Store, which is crazy overkill since I have not even developed my app yet, I just want to see if this API can provide functionality I need.
In summary, my question is this:
How can I run my app locally as a kiosk app such that I can access these APIs?

Enabling a Kiosk App on a Chromebook

I am currently developing a kiosk application and have been trying to use the "Manage kiosk applications..." option in the Chrome://extensions page when developer mode is on.
Whenever I choose an application in the manage kiosk applications popup it just saying invalid application. I've tried local IDs, Chrome Web Store IDs and still nothing works.
In the manifest I've allowed kiosk mode and have another version with kiosk only enabled but that still doesn't work.
This is not a hosted app, all the assets are local and the Chromebook is not managed.
I've tried other solutions such as logging out and pressing ctrl+alt+k at login. I've wiped the chromebook and restarted fresh.
Any help would be appreciated.
If you're not hosting the app in the Chrome Web Store, Managing Kiosk Applications should be done by entering the app ID and the URL of the third-party web server in the Specify a Custom App dialog and click Add.
You may check Create a Chrome Kiosk App to know more details on how to create, publish and add the app as kiosk app.
Kiosk apps can only be installed from the "Manage kiosk applications..." menu if they are published in the Chrome Web Store as either "Public" or "Unlisted". If the app is published as "Private" it will fail to load.

is it possible to keep a packaged app running after `chrome.runtime.reload()` without additional windows?

I have a packaged app that calls chrome.runtime.reload(). On a desktop OS (Windows, OSX) this call will cause the application to close, but not restart unless there is an additional Chrome page open.
I assume this is because if it is the only Chrome app running, it closes the Chrome process entirely and there is nothing to restart it.
Adding the background permission looks like it should work, according to the documentation but it does not seem to actually start Chrome when the user logs in (and keep it running) as the documentation states.
A user can override this globally with a setting.
In Chrome's settings with "Show advanced settings":
System > Continue running background apps when Google Chrome is closed
Perhaps it is disabled on your development system.

Is there a way to show desktop notifications even if Chrome closed?

I'm developing a Google Chrome Extenstion, I wonder if there is anyway to show desktop notifications even if Chrome is closed, maybe some sort of background process or service? Kindly advice and guide me if it is not possible also. Thanks.
If you request a "background" permission your extension's background page will be able to show notifications even with Chrome windows closed.
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.
If you use Google Chrome, you can enable a new Gmail feature that shows desktop notifications for new messages. Go to "Settings", and enable chat notifications and mail notifications to see a small bubble when you get a new message.
Secondly: Using WCF or Windows Services:
you have to develop simple client on machine polling a central service for alerts. Each alert should have a unique id so each client can deal with idem-potency
I Hope that this will be helpfull to you
Regards: Azeem Raavi