How do I make notications appear on Chrome and Chrome OS, like Pushbullet and Google Now? - google-chrome

Pushbullet and Google Now have notifications, which can pop up depending on time or place or any other trigger. If I have to add this feature to my app, how can I do it?

You have two options:
https://developer.chrome.com/extensions/notifications as pointed out by #Moin in the comments. This will only work for people that decide to install your chrome app on desktop (no support for chrome in Android)
Using the new push notifications APIs as described in
https://developers.google.com/web/fundamentals/getting-started/push-notifications/
The latter is probably recommended if you can live with the following caveats:
It's a bit more basic API
Users needs to opt in via a prompt
The site needs to be https

Related

How To Privately Test A Chrome Extension Disabled Because It Is Not Listed In The Chrome Web Store

I have written a simple Chrome extension and tested it using developer mode to load the unpacked extension. It works as expected this way.
Because the extension uses storage.sync API, I would like to undertake further testing with installations of the extension as published in the Chrome Web Store.
The Developer Dashboard for Chrome Web Store provides an option to publish to trusted users only:
Only trusted testers from your developer dashboard can see it.
You can also include members of a Google Group that you own or manage.
When I publish this way the trusted testers listed for my dashboard can reach the extension and install it from the Chrome Web Store. However, the extension is always disabled upon starting Chrome:
This extension is not listed in the Chrome Web Store and may have been added without your knowledge. Learn more
We, my testers and I, have not been able to find any way to enable an extension disabled by Chrome. Is there one? If not, the entire exercise of an "unlisted" publication mode for testing seems pointless.
The only work around I've found to this situation so far is to set the extension to "unlisted" rather than "published to testers" from the Chrome developer dashboard.
This is not at all satisfying, but did allow some real world testing in an unobtrusive way.

Is there a way to display desktop notifications even when Chrome or Firefox is closed?

We're developing a website which sends push notifications to end users using GCM. We've gone through Service Worker and all. We have developed a prototype using this codelab tutorial. It is working so far, but the only issue is the notifications are displayed only when Chrome is opened. When Chrome is closed, the notifications don't reach the users.
I want to know is there any way we can overcome this and display the notifications even when the browser is closed, similar to Safari Push Notification. Thanks in advance!
If you have a "background" permission in manifest.json, your background page will be able to show notifications even when Chrome window is closed.
"permissions": [
"background"
],
As stated in the documentation:
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.
You need to use the "background" permission with a background page, event page or a background window for hosted apps.
For web, use Push API for Chrome and other browsers. The advantage of using push messages is that even if your page is closed, your service worker will be woken up and be able to show a notification. Web Sockets and EventSource have their connection closed when the page or browser is closed so it's not recommended. Here is the documentation and example.
In Chrome. Only those users that happen to have an extension installed that requires background mode, like hangouts, will be able to receive push notifications when chrome is not "running". It does not seem like a good idea to rely on it.
The chrome team seems to be considering it for web push too but so far there is no ETA.
https://code.google.com/p/chromium/issues/detail?id=402456
Showing notification when the browser or tab is closed requires the service worker and a third party service (like google firebase)to trigger the service worker.
https://github.com/web-push-libs/ - Check these list of libraries to implement this in different platforms.
https://github.com/rijoshrc/php-service-worker-push-notification - Clone this git repository to see the simple implementation in PHP.

How to share a packed Chrome Extension without publishing?

I have seen other answers here, such as this.
But nowadays, you cannot simply drag an extension to the browser and expect it to work. Google does not allow you to activate it, showing a message "not downloaded from chrome store"
Now, I really don't want to publish anything. It's a personal extension for me and friends! How can I workaround this limitation?
You could publish to testers.
I know you said you didn't want to publish anything but it only shows up to google accounts you have listed at testers.
You really only have two options:
Distribute the crx and have them run in developer mode.
List the extension on the Chrome store.
It sounds like #1 is a problem for you (as it is for most). If you go with option #2, you can list the extension privately, so it isn't listed in the Chrome store.
For context, Google is not doing this to hold people back. Most of the browsers have tightened up these methods to prevent abuse. From Google's perspective, they cannnot differentiate between your friendly use case, and a hacker using an extension to place malware. If it's published through the store, they can scan for malware.

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.

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.