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

Guides

  • Table of Contents
  • App Resources
  • Appstore Publishing
  • Best Practices
  • Communication
    • Advanced Communication
    • Datalogging
    • PebbleKit Android
    • PebbleKit JS
    • PebbleKit iOS
    • Sending and Receiving Data
    • Sports API
  • Debugging
  • Design and Interaction
  • Events and Services
  • Graphics and Animations
  • Migrating Older Apps
  • Pebble Packages
  • Pebble Timeline
  • Rocky.js
  • Smartstraps
  • Tools and Resources
  • User Interfaces

Communication

This page contains some instructions that are different if you're using CloudPebble or if you're using the SDK locally on your computer.

Select whether you're using CloudPebble or the SDK below to show the relevant instructions!

CloudPebble

SDK

Showing instructions for CloudPebble. Not using CloudPebble?

Showing instructions for the SDK. Using CloudPebble?

All Pebble watchapps and watchfaces have the ability to communicate with the outside world through its connection to the user's phone. The PebbleKit collection of libraries (see below) is available to facilitate this communication between watchapps and phone apps. Examples of additional functionality made possible through PebbleKit include, but are not limited to apps that can:

  • Display weather, news, stocks, etc.

  • Communicate with other web services.

  • Read and control platform APIs and features of the connected phone.

Contents

  • Advanced Communication - Details of communication tips and best practices for more advanced scenarios.

  • Datalogging - Information on how to collect data batches using the Datalogging API.

  • PebbleKit Android - How to use PebbleKit to communicate with a watchapp on Android.

  • PebbleKit JS - How to use PebbleKit JS to communicate with the connected phone's JS environment.

  • PebbleKit iOS - How to use PebbleKit to communicate with a watchapp on iOS.

  • Sending and Receiving Data - How to send and receive data between your watchapp and phone.

  • Sports API - How to use the PebbleKit Sports API to integrate your mobile sports app with Pebble.

Communication Model

Pebble communicates with the connected phone via the Bluetooth connection, which is the same connection that delivers notifications and other alerts in normal use. Developers can leverage this connection to send and receive arbitrary data using the AppMessage API.

Depending on the requirements of the app, there are three possible ways to receive data sent from Pebble on the connected phone:

  • PebbleKit JS - A JavaScript environment running within the official Pebble mobile app with web, geolocation, and extended storage access.

  • PebbleKit Android - A library available to use in Android companion apps that allows them to interact with standard Android platform APIs.

  • PebbleKit iOS - As above, but for iOS companion apps.

Important

PebbleKit JS cannot be used in conjunction with PebbleKit Android or PebbleKit iOS.

All messages sent from a Pebble watchapp or watchface will be delivered to the appropriate phone app depending on the layout of the developer's project:

  • If at least an index.js file is present in src/pkjs/, the message will be handled by PebbleKit JS.
  • If the project contains at least one JavaScript file, the message will be handled by PebbleKit JS.
  • If there is no valid JS file present (at least an index.js) in the project, the message will be delivered to the official Pebble mobile app. If there is a companion app installed that has registered a listener with the same UUID as the watchapp, the message will be forwarded to that app via PebbleKit Android/iOS.