pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • Examples
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

Guides

  • Table of Contents
  • Alloy
  • App Resources
  • Best Practices
  • Communication
  • Debugging
  • Design and Interaction
  • Events and Services
  • Graphics and Animations
  • Pebble Packages
  • Pebble Timeline
    • Creating Pins
    • Libraries for Pushing Pins
    • Local Pins
    • Managing Subscriptions
    • Public Web API
    • Service Architecture
  • Tools and Resources
  • User Interfaces

Local Pins

PebbleKit JS can insert pins into the timeline directly from the phone. Local pins are created by the new Pebble app and synced to the watch, which means:

  • No timeline token, API key, or appstore listing is needed, so sideloaded apps can use them.
  • Pins only exist on the phone that created them - they are not shared with the user's other phones, and cannot be created while your app's JS is not running.

The new Pebble app does not support the timeline web API, so pins can no longer be pushed to users from a web server. Local pins are the only way to add pins to the timeline.

Inserting a Pin

Pass a pin object (or a JSON string) in the format described in Creating Pins:

Pebble.insertTimelinePin({
  id: 'local-pin-1',
  time: new Date().toISOString(),
  layout: {
    type: 'genericPin',
    title: 'Local pin',
    tinyIcon: 'system://images/NOTIFICATION_FLAG'
  }
});

The id is chosen by you and only needs to be unique within your app. Inserting a pin with an id that already exists updates that pin, rather than creating a second one.

Deleting a Pin

Pins are removed using the same id they were inserted with:

Pebble.deleteTimelinePin('local-pin-1');

Existing Timeline Web API Code

Apps written against the timeline web API do not need to be rewritten to keep working. Requests made from PebbleKit JS to timeline-api.rebble.io or timeline-api.getpebble.com under /v1/user/pins are intercepted by the phone and turned into local pins instead of being sent to a server - a PUT or POST inserts the pin in the request body, and a DELETE removes the pin named in the URL. The request completes with a 200 response and an empty body.

Only requests made by your app's JS are intercepted. Pins your backend pushes to the timeline web API will never reach the watch.

Interception can be turned off by the user with the 'Emulate Timeline Webservice' setting in the Pebble app, so new apps should call Pebble.insertTimelinePin() directly.

Unsupported Fields

Local pins use the pin format described in Creating Pins, with the following exceptions:

Field Behavior
createNotification Ignored - no notification is shown when the pin is created.
updateNotification Ignored - no notification is shown when the pin is updated.
actions Ignored. Every local pin gets a 'Remove' action.
primaryColor, secondaryColor, backgroundColor Ignored.

All other fields, including duration and reminders, are supported.

You need JavaScript enabled to read and post comments.

Overview

  • Inserting a Pin
  • Deleting a Pin
  • Existing Timeline Web API Code
  • Unsupported Fields