Question

I have seen this article about passing messages between extensions which works when you know the extension ids.

But, what I would really like to do is pass a message from a packaged app to an extension. I tried to implement the steps in the article above. But i received the message that chrome.extension is not defined.

I assumed this is because it is a packaged app, that it doesnt have chrome.extension.

Is there a way to do this?

Thanks AH

Was it helpful?

Solution 2

Cross-extension messaging

In addition to sending messages between different components in your extension, you can use the messaging API to communicate with other extensions. This lets you expose a public API that other extensions can take advantage of.

Listening for incoming requests and connections is similar to the internal case, except you use the runtime.onMessageExternal or runtime.onConnectExternal methods.

http://developer.chrome.com/dev/extensions/messaging.html

OTHER TIPS

You should be able to accomplish via Web Intents, specifically the "explicit" variant that can be targeted at a specific app/extension. See this sample in the apps repository for two apps that communicate via explicit Web Intents (the same concept can be applied to an extension and an app, except the extension would receive intents via a URL specified in the manifest).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top