google-chromemanifesthosted-app

Chrome packaged app cookie access, legacy packaged app creation


I'm developing an application that helps user learn foreign languages. We have been using chrome hosted app + background page that was sending notifications (something like flashcards with words to learn) through webkitNotifications.createNotification but lately chrome have established their own rich notifications api (here is example github repo: https://github.com/GoogleChrome/chrome-app-samples/tree/master/rich-notifications) which isn't available for hosted_apps and blocks webkitNotifications

Now I'm responsible for fixing this issue, and creating new app, but new notification api is available only through packaged apps and extensions.

So far I've been working with packaged app but I've encountered a serious problem that I can't pass: chrome packaged apps don't have access to chrome.cookies api which is needed for me to get customized data for those notifications per user.

My question is: Is there any possibility to access cookies api in packaged app? Also is there any possibility to create LEGACY packaged app (which seems to have both of apis that I need)

Here is what I've managed to do so far:

manifest.json

{
  "name": "__APP__",
  "description": "__DESC__",
  "short_name": "__APPNAME__",
  "version": "1.0",
  "default_locale": "en",
  "offline_enabled": false,
  "app": {
    "background": {
      "scripts": ["main.js", "app.js"],
      "persistent": true
    }
  },
  "icons": {
    "128": "icon_128.png"
  },
  "permissions": [
    "notifications", "http://my.site.com/*"
  ],
  "manifest_version": 2
}

main.js (it provides same behaviour that hosted app for me)

chrome.app.runtime.onLaunched.addListener(function () {
  window.open("http://my.site.com/");
});

app.js is a file that gets json data from my server and tries to create notifications (not pasting here since it isn't relevant for now)


Solution

  • You can always use local storage instead of cookies. Just search Google for it. Cookies also have a bad reputation these days.

    Edit: Re: legacy packaged app You can always download an old chrome version and package your app using the old one. You should try downloading a portable chrome version so you can keep using your current one.