The background permission is very important. Without it, how do you create the window?

chrome.app.window.create(...)

I have an app with the following manifest:

{
    "manifest_version": 2,
    "name": "MyApp",
    "description": "MyApp",
    "version": "0.7",
    "minimum_chrome_version": "27",
    "offline_enabled": true,
    "options_page": "options.html",
    "icons": 
    {
        "16": "images/icon16.png",
        "48": "images/icon48.png",
        "128": "images/icon128.png"
    },
    "app": 
    {
        "background": 
        {
            "scripts": 
            [
                "scripts/messaging.js",
                "scripts/utils.js",
                "scripts/database.js",
                "scripts/fs.js",
                "scripts/background.js"
            ]
        }
    },
    "permissions": 
    [
        "unlimitedStorage",
        "fullscreen",
                {
            "fileSystem": 
            [
                "write"
            ]
        },
        "background",
        "<all_urls>"
    ],
    "update_url": "http://192.168.1.101/chrome/crx/updates/MyApp2.xml"
}

This app shows as full screen. The database and file handling, as well as the creating of the user's window is all handled by background.js which runs in the background. In a regular Chrome App when I've tried to add some of those functions (for example, chrome.app.window.create(...) which is what creates the client window), the runtime has thrown an error saying those functions/objects don't exist in the front end. So, without background permission, how do I do those things?

有帮助吗?

解决方案

First, some naming clarifications:

I believe your question is: "I have a Chrome App which runs on Desktop Chrome, and it uses the "background" and "fullscreen" permissions. When I use cca to create a port for Mobile, cca complains that the permissions are not recognized."

Well, the good news is that all cca apps are always "fullscreen" and "background". The warning message is just because v2 Chrome Packaged Apps don't require those permissions, and so we missed adding them to our whitelist of accepted permissions.

The warnings, in this case, are safe to ignore (though I'm not sure if there exists a fullscreen API, that likely won't work). Those warnings are useful when you require a permission we really do not support yet, say, like "bluetooth".

So I guess my question is: did you try moving on to the next step to see if it worked?

Edit: With the latest release of cca to npm (v 0.0.11) we should not show warnings if your app requests these permissions.

其他提示

The background permission you're asking for in your permissions is a different background permission to the one you mean, which doesn't need any permission at all.

-> To let you background page get loaded by chrome, so that your app can handle events, doesn't need a permission. This is something all apps can do.

-> To make your app force chrome to run all the time is something hosted apps and legacy packaged apps can do. We are working on making this available to all packaged apps as well, but for now they can't. This requires the 'background' permission. I don't think you want or need this.

So I'd say your error is something else. Can you provide your scripts/background.js file?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top