So, You Wanna Make a Pebble App?

'Wearables' as they are called is an interesting space right now.  Dominated with fitness bands that seem more fad than useful, saying that the state of the technology is in its infancy is being nice.  My biggest criticism of what's currently out there is lack of 3rd party developer support.  It could be argued that the iPhone (and by extension, Android) wouldn't be nearly as successful as it has been without other developers to build things that OEMs didn't originally think of or consider.

One of the stand-outs from this perspective is Pebble.  It has had 3rd party dev support practically since day one.  Its first release was quite rough, but v2.0 really unlocked some potential, allowing devs to persist data to the device, for example.  Even still, the path is far from well-tread and is beset with quite a few issues that are less than friendly to figure out.  Here's hoping that you can learn from my own mistakes.

Low Level Programming

C is a marvel.  The programming language can run practically everywhere and Dennis Ritchie definitely deserved receiving the National Medal of Technology because of his association with C, Unix, and other foundational technologies that we now take for granted.

But it is also a pain.  And the pain gets worse because you'll be writing a stripped down version of it that doesn't contain functions and libraries you may be accustomed to using.  The reason why: your Pebble app must fit in 24k of RAM. Yes, twenty four kilobytes of gold plated random access memory.

Get ready to get your hands dirty.  If nothing else, low-level programming makes you appreciate what higher-level languages and tools do for us. :)

Debugging

There is no debugger.  I'm sorry.  This is a watch that connects with your phone via BlueTooth.

The Pebble 2.0 SDK comes with some higher-level logging capabilities, but require your phone to even see them.  I ended up using a 'debug label', a label added to the screen, for printing debug output.  It isn't incredibly useful when you're trying to debug memory issues, but it's better then trying to conduct a seance with your watch to tease out issues.

Build Your App In Stages

Because debugging is a pain, build your Pebble app in stages.  Have a plan for how you're going to build things, but don't try and do it all at once.  Start small and work big.  Commit or stash frequently so that if things go awry, you can roll changes back.  This is common sense when you're developing for a new platform, but sometimes we forget this important lesson.

Sample Apps and Documentation

The documentation that Pebble provides is...complete...but lacks clear examples on how to use all of the APIs.  Even though the SDK includes several sample applications, the coverage leaves a little to be desired.  This problem is compounded by the vast changes that were made between 1.x and 2.0 SDKs and all the search engines mostly giving back 1.x results.

Only when I had concluded making my first Pebble app did I stumble across this site that is very illustrative on how to build Pebble 2.0 apps.  I leveraged the excellent info here to add animations to my app.  It has really good basic examples and the author was even gracious to post all the code to GitHub.

Preparing for the Pebble App Store

Congratulations!  You got your Pebble app ready.  You got your iPhone code ready.  But you are actually far, far away from being ready.  Preparing for the Pebble Store is not something you do last.  You should start early in the development process.

Because the Pebble is an official Made For iPhone (MFi) accessory, there are a couple of hoops that you have to jump through that will add time to the review process. Take these steps, and the amount of time it takes to follow them, into consideration when planning your release.  If you do things right, you'll have done a bunch of this work ahead of time.  I did not and have had to learn the hard way:

  1. Create a Pebble App Store profile for your app.  This will create a Pebble Store ID for your Pebble app, which will be required in the next step:
  2. Fill out a white list request with Pebble.  Among other things, this form will ask you what the Pebble Store ID is for your Pebble app, as well as the bundle ID of your iPhone app.
  3. Go on vacation.  Seriously.  Pebble only submits their whitelist requests to Apple once a week (a Monday), so if you miss the cutoff, then you'll be stuck in the queue until the following submission.  Apple will take its sweet time as well, adding them a few days after Pebble submits the change.  Once Apple has whitelisted it, it could take 24-48 hours for the system to actually register in its systems for the reviewers.
  4. Once you have received word from Pebble that Apple has added your information to their Made For iPhone (MFi) program, you're now free to submit your iPhone app to the App Store for review.

I did all these steps at the very end of development.  With the back-and-forth with this process, it has taken more than three weeks (and still counting) to get my app through review.  YMMV, but DO NOT save this step for last.  You should be able to coordinate all of this such that everything is ready to go when your code is also ready to send off.

Wrap Up

Hopefully these things didn't dissuade you from thinking of building a Pebble app.  Pebble is just starting as a platform, but the promise is certainly there.  I really can't wait to see what happens with it and other wearables in the future.

Posted on May 4
Written by Wayne Hartman