Developers

Settings, share targets and App mode

Pulsar draws your app’s settings from JSON, opens shared links inside it, and keeps its window, cookies and storage apart from everything else.

Settings

settings is the same SettingSpec extensions use for their settings page: toggles, choices, chips, sliders, text fields and buttons. Pulsar draws it in ⋮ › App settings, in its own style, light and dark. See Native UI for every item.

The App starter’s settings
Spec
{
  "sections": [
    {
      "title": "Look",
      "items": [
        {
          "type": "choice",
          "id": "theme",
          "title": "Theme",
          "icon": "moon",
          "value": "auto",
          "options": [
            {"value": "auto", "label": "Like the phone"},
            {"value": "light", "label": "Light"},
            {"value": "dark", "label": "Dark"}
          ]
        },
        {
          "type": "chips",
          "id": "text_size",
          "value": "m",
          "options": [
            {"value": "s", "label": "S"},
            {"value": "m", "label": "M"},
            {"value": "l", "label": "L"}
          ]
        }
      ]
    },
    {
      "title": "Cooking",
      "footnote": "These settings only change Example Kitchen inside Pulsar.",
      "items": [
        {
          "type": "toggle",
          "id": "cook_mode",
          "title": "Keep the screen on",
          "sub": "While a recipe is open",
          "icon": "sun",
          "value": true
        },
        {
          "type": "toggle",
          "id": "hide_popup",
          "title": "Hide the newsletter pop-up",
          "icon": "eye_off",
          "value": true
        }
      ]
    }
  ]
}
  • The values in the spec are the defaults. Pulsar keeps each user’s choices for your app and checks them against the spec.
  • Your CSS and JS follow them with when and __pulsarApp.settings() (CSS, JS and headers).
  • After an update, values the new spec no longer accepts are dropped and the default comes back. Keep ids stable.
  • Pulsar adds its own rows under yours: Reset to app defaults and About this app (version, where it updates from).
  • At most 12 sections and 40 items; ids are 1–40 letters, digits, ., _ or -, unique in the pack.

Share targets

When someone shares a link or text to Pulsar from another Android app, your app can be one of the places it goes. The address opens inside your app.

pack.json
"share_targets": [
  { "id": "save", "name": "Save as a recipe",
    "url": "https://example.com/save?url={url}&title={title}",
    "accepts": { "types": ["url"], "sites": [] } },
  { "id": "search", "name": "Search recipes",
    "url": "https://example.com/search?q={text}",
    "accepts": { "types": ["text"] } }
]
FieldRule
id1–40 of a–z 0–9 . _ -, unique in the pack.
nameUp to 40 characters, the line under your app’s name in the “Send to…” picker.
urlhttps on your own domains, with placeholders.
accepts.typesurl (links) and/or text.
accepts.sitesOnly links from these sites (and their subdomains), up to 20. Empty or missing: any site.
PlaceholderBecomes
{url}The shared link (or the shared text, when there is no link).
{text}The shared text (or the link, when there is no text).
{title}The subject or title, when the sharing app gives one.
  • Pulsar URL-encodes every placeholder for you.
  • A link target needs {url} (or {text}); a text target needs {text}. {title} alone is refused.
  • Up to 5 targets per pack. Some video sites can’t be target sites (store rules); links from them only go to Pulsar’s own places.
  • In the picker, apps that name the link’s site come first; the first one is Suggested. People can choose “Always use my choice” per site, and switch any target off in Settings › General › Share targets.
  • If the app is off or removed, the address opens in a normal tab.

App mode

FieldWhat people get
"display": "standalone"Its own window with a slim top bar in theme_color, the app’s name and “Running in Pulsar · Open in browser”.
"display": "fullscreen"Its own window with no bar at all. Good for games and full-screen tools.
"opens_as": "app"Opens in App mode (the default).
"opens_as": "tab"Opens as a browser tab that belongs to the app: same cookies, CSS and JS as the window.
  • People can change how it opens after they install it, and add it to the home screen.
  • Apps and their home-screen shortcuts never go to sleep like background tabs.
  • An update that changes the name or icon updates the home-screen shortcut too.

Cookies and logins

  • Every app has its own cookie jar, with its own storage and logins. Signing in to your app doesn’t sign anyone in to your site in the browser, and the other way round.
  • The jar belongs to that install. Removed and installed again, the app starts signed out.
  • Removing the app clears its cookies, storage, saved page and shortcut.
  • Plan for it: your site’s sign-in must work inside the app on its own. Don’t depend on a cookie set in the browser.

Storage

  • Your site’s own storage — cookies, localStorage, IndexedDB, its cache — lives in the app’s jar, apart from the browser’s.
  • Pulsar keeps the exact text of your pack and each user’s settings on the phone. An update replaces the pack in one step; a failed update leaves the old one.
  • When the app is removed, Pulsar clears everything it kept for it, even if that happens before the browser has started.