Reputation: 371
I'm developing a chrome packaged app and chrome extension, both of them communicate with one another, and i want to lunch my packaged app from a chrome extension, is there any way to do it?
Note: I've tried using the launchApp method of chrome management api, but for some unknown reason the chrome.management is undefined in my chrome extension JS code, although i have specified management permission in my manifest file like so:
"permissions": ["management"]
Does anyone have a idea what is the problem, or there are any other way i can do it ?
Thanks for help:)
Upvotes: 1
Views: 267
Reputation: 77482
There are 2 possible reasons for not being able to use chrome.management
.
You have not reloaded your extension properly
You are trying to call this from a content script; you can't do that, since a content script has very restricted access to Chrome API. You need to message a background page to do this for you.
That said, there is a better way to do it if you write both your extension and your app. "management"
permission is a big hammer and will generate a warning to the user on installation.
Instead, you can send a cross-extension message to your app. It will wake it up and you can launch your main window from there. See this answer for details.
Upvotes: 2