16
Data on your wrist DEVELOPING PEBBLE SMARTWATCH APPS Michael Earls Advanced Systems Design http://cerkit.com [email protected]

Developing Pebble Smartwatch Apps

Embed Size (px)

Citation preview

Page 1: Developing Pebble Smartwatch Apps

Data on your wristDEVELOPING PEBBLE SMARTWATCH APPS

Michael EarlsAdvanced Systems Design

http://cerkit.com

[email protected]

Page 2: Developing Pebble Smartwatch Apps

Getting started

with ASP.NET

WebAPI

DEVELOPMENT

ENVIRONMENT, HOSTING,

AND DEMO APP

Page 3: Developing Pebble Smartwatch Apps

What is WebAPI?

ASP.NET Web API is a framework that makes it easy to

build HTTP services that reach a broad range of clients,

including browsers and mobile devices.

ASP.NET Web API is an ideal platform for building RESTful

applications on the .NET Framework.

REST – REpresentational State Transfer – HTTP GET, POST,

PUT, DELETE

Page 4: Developing Pebble Smartwatch Apps

WebAPI – IDE and Hosting

Visual Studio 2013-2015

Community Edition (Free)

Professional Edition (Paid)

Visual Studio Code

Mac, Linux, and Windows

Hosting

Any host that supports ASP.NET 4.5.x

Windows Azure is easy to set up

Page 5: Developing Pebble Smartwatch Apps

Creating a WebAPI Project

Standard Web Project

Add WebAPI

Add MVC if you wish to build a web

front-end to your API

Page 6: Developing Pebble Smartwatch Apps

WebAPI Project Creation

DEMO

Page 7: Developing Pebble Smartwatch Apps

Getting started

with Pebble app

development

DEVELOPMENT

ENVIRONMENT, LANGUAGE

SUPPORT, AND SAMPLE

CODE

Page 8: Developing Pebble Smartwatch Apps

Development Environment – Pebble not required

Pebble C SDK

Apple OSX – Xcode or other IDE

Linux – editor/IDE of choice

No Windows Support

Cryptic compiler error/warning messages

Standalone Emulator

Allows you to link outside libraries

App configuration in .json file

CloudPebble(http://cloudpebble.net)

Online IDE

Chrome browser on any platform

C, Pebble.js languages

Good, easy to understand compiler errors/warnings

Browser-based emulator

No outside libraries supported

Easy app configuration

Page 9: Developing Pebble Smartwatch Apps

Language Support

JavaScript (Pebble.js)

Runs on phone

Requires active Bluetooth connection to Pebble App on phone

Supports:

WebSockets

XMLHttpRequest

Geolocation

LocalStorage

C

Runs on watch

Does not require connection to phone unless JavaScript is also used

Page 10: Developing Pebble Smartwatch Apps

CloudPebble Demo

Developing an app in CloudPebble

Page 11: Developing Pebble Smartwatch Apps

App Settings Page

HTML/JavaScript Page

Hosted on the Internet

Opens in WebViewer from within Pebble

smartphone app

Page 12: Developing Pebble Smartwatch Apps

Settings Page

Bootstrap

JavaScript to determine test or production

modes

Code to set configuration settings on the

watch

Page 13: Developing Pebble Smartwatch Apps

Settings Page

Demonstration

Page 14: Developing Pebble Smartwatch Apps

JavaScript integration with C

Phone functionality (GPS, Internet, Weather, etc.) requires JavaScript

Must pass values between C code and JavaScript code using a dictionary

Steps to pass data:

Setup callbacks in C code

app_message_open() – C code that starts the process of requesting a message

Pebble.sendAppMessage() – Pebble.js code that actually sends the message

Uses a JavaScript object representing a simple dictionary containing the values you wish to send

inbox_received_callback() – C code that processes call as a dictionary of

Tuples containing the data that was passed in

Page 15: Developing Pebble Smartwatch Apps

How do I make money with Pebble?

Pebble apps are all free on the

Pebble app store

Companion apps on Google Play or

Apple app store

Page 16: Developing Pebble Smartwatch Apps

Links

CloudPebble – http://www.cloudpebble.net

Discogs REST API – http://www.discogs.com/developers/

Settings Page Gist - https://gist.github.com/cerkit/c5e42de6016067d1d585

Getting started with WebAPI - http://goo.gl/FGk6gW

My personal blog – http://cerkit.com

@cerkit on Twitter