Creating Communication Apps and Phone app gives you total control over integration between these two and gives the ability to customize the user experience in every detail.

Examples of what you could do:

Your Communication app could be a mini-dashboard of your phone app,

Your phone app might fetch data from the web, and then display it on your wrist via your communication apps,

The communication app could be a little remote control for your phone app, making use of Pebble’s buttons to trigger actions on the phone,

… the sky is the limit!

Got excited? Let’s dive into it.

APPMESSAGE: BI-DIRECTIONAL COMMUNICATION

The foundation for integrating a Communication app and phone app is the channel between them. Pebble communicates with the phone for all sorts of reasons over Bluetooth and this is one of them. Don’t worry; you don’t have to deal with Bluetooth directly. Instead, we are providing you with a slightly higher level API that called as App Message. These APIs implement a push-oriented messaging protocol. This means there are functions/methods through which you can call to push messages to the other end, in both ways, from watch to phone and vice versa.

Please read more about App Message’s innards, in the AppMessage API reference page of the Watch App SDK.

Communication App Development

PEBBLEKIT IOS & ANDROID

On both iOS and Android, there are libraries that you can integrate into your mobile apps to make it easy to communicate with your Pebble watchapp.

ANDROID

All communication between Pebble and an Android device is dealt through the local Pebble Service on the Android device (installed by the official Pebble Android app). Pebble Service uses Android’s intent messagingsystem for communication between Android devices and Pebble, making it easy for developers to add optional Pebble support to Android applications.

Regarding AppMessage, the official Pebble Android app listens for AppMessage messages that come in from the watch and relays those messages to your Android app using the Intent bus.

The other way around, the Pebble Android app listens for specific Notifications on the Intent bus, transforms them into AppMessage Dictionaries and relays them to the watch using the AppMessage protocol.

PebbleKit holds a helper class that abstracts most of the details away and makes it really easy to send/receive messages to/from your watchapp. Also provided are example projects.

IOS

On iOS, there is the impression of a “communication session” between an app and the Pebble watch. You can supposethis as a “data pipe” directly from the watch to your app. However, there is only one session allowed for 3rd party apps. This one session needs to be shared among all 3rd party apps that want to communicate with Pebble (excluding the official Pebble iOS app).

Unfortunately, the session can only be opened from the phone app. This means that the iOS app has to start talking to the watch first to open the communications channel; the other way around is not possible. Most methods in the PBWatch categories (Ping), (Version), (Sports), (Golf) and (AppMessages) all implicitly open the shared communication session.

Lastly, iOS provides no better way to manage how the one shared session is accessed or used. Simply, the last iOS app to try to open,it wins and gets to use it. Therefore, it is important that your iOS app does not try communicate at once upon a connection event (e.g. in the -pebbleCentral:watchDidConnect:isNew: of PBPebbleCentralDelegate).

When the user stops using your app (e.g. when going to the background or when explicitly stopping a certain activity in the app) your iOS app should close the communication session using the -closeSession: method.

PebbleKit contains a compiled framework and example projects. The framework abstracts away the AppMessage protocol and contains methods and categories to send and receive messages using familiar classes like NSDictionary.

GETTING STARTED

PebbleKit offers a number of example projects to get you started quickly. The most basic one is a watchapp that shows the local weather, based on data provided by a phone app. Have a look at these files:

Watchapp example: demos/feature_app_message/weather
Android app example: ExampleWeatherActivity.java
iOS app example: WeatherDemo.xcodeproj

Download PebbleKit

CURRENT LIMITATIONS

We’re continuously working to push the bar higher. Let us know what limitations are in your way!

Only the watchapp that is in the foreground can send and receive messages from the phone app

On iOS, there are various limitations, as described above.

SUBMITTING IOS APPS WITH PEBBLEKIT TO APPLE’S APP STORE

In order for Pebble to work with iPhones, Pebble is part of the Made For iPhone program (a requirement for hardware accessories to interact with iOS apps). Unfortunately this

also means that if you build an iOS app with PebbleKit, we (Pebble) will need to whitelist your iOS app before you can upload it to the App Store.