Communicating between a Chrome packaged app and a Chrome extension?
Solution 1:
Yes, that is possible. The code sample in the documentation you linked works for any combination of app and extension.
The extension documentation for chrome.runtime.sendMessage
says:
Sends a single message to
onMessage
event listeners within the extension (or another extension/app).
Messaging works the same in both extensions and apps, and they seem to be fully compatible; simply use the ID for the destination extension or app. If you look at the docs for the app version of chrome.runtime.sendMessage
, you'll see that it is identical to the extension version.