The Pebble Smart Watch combines with Salesforce to create a great user experience. Join us as we show you how to connect to the watch, display critical information on it, and communicate back to Salesforce in real time. You will experience a deep dive into the Pebble SDK and powerful platform technologies like the Streaming API.
DF14: Drive Salesforce User Productivity with the Pebble SmartWatch
1. Drive Salesforce User Productivity with
the Pebble SmartWatch
Richard Tuttle
Oklahoma City Developer User Group Leader
@_drako
Jayvin Arora
Philadelphia Salesforce User Group Leader
@JayvinArora
6. Technological Trends
• From Gartner’s Top 10 Strategic Technology Trends for 2014
The Internet of Things
The Personal Cloud
Hybrid IT and Cloud Computing
Companies have access to wearable techhology
to connect their users to their company and personal clouds
securely.
7. Smart Watches
• Pros
– Extends mobile apps beyond the pocket
– Key use cases is “glance-able" information and light weight interactions.
• i.e. push notifications
– Lets people stay informed with discreet alerts/notifications, without having to look at phone.
– Can incorporate extensive functionality in the physical space where people just wear a
watch/used to wear a watch
– User Adoption is expected to grow to 130 Million users by 2018
8. Smart Watches
• Cons
– Limited System Resources:
• Limited battery life- limits the frequency of display updates.
– Difficult to have a meaningful UX
• Small screen space
• Limited UI functionality depending on the watch
– People see the devices as a gimmick.
– Narrow use cases, especially in a mobile society
9. Pebble Smartwatch
• Product Overview
– Released Q3 of 2013 via a kick starter (Compared with Apple Smartwatch 2015)
– Black and white e-paper display, ambient light sensors, vibrating motor, magnetometer and an
accelerometer.
– Compatible with Android and iOS devices
– 1 bit Graphical Display ( Black, White, and Dithered graphics)
– 3 Button Input
10. Pebble Smartwatch – Technical Considerations
Platforms
?
• iOS – SDK, and native Pebble app with PebbleKit-
JS
• Android – SDK, and native Pebble app with
PebbleKit-JS
• Windows Phone 8 – Nothing native at this point,
some custom apps derived from an open source
project called Flintlock and libpebble
• Blackberry – Haha, just kidding
11. Pebble Smartwatch
• Technical Considerations
– Tethered to your smart phone
– Communicates with phones via Bluetooth Low Energy ( BLE)
– Supports two-way communication between pebbles and smartphones running iOS or Android via
the AppMessage framework.
– Open Pebble SDK
– Battery life 5- 7 days
– Pebble provides code and background to get you started quickly.
13. Components of a Pebble Application
The window stack
• Used to allow multiple layers of windows
throughout the entire Pebble UI
• WatchApps can have multiple windows used
for different purposes
• Control the flow of the application by pushing
different windows into/from the stack
• Can be used to separate functional areas of
your code
14. Pebble Applications
2 types of Applications in Pebble
• WatchApp
– Has to be accessed from the menu
– Doesn’t retain the main window space permanently
– Can be triggered to open from events sent by the
phone
– Access to all 3 right side buttons, accelerometer,
and magnetometer
• Watchface
– WatchApp that is designed to show the time
constantly
– Limited input options, no buttons, only
magnetometer and accelerometer
15. Components of a Watch App
• Pebble Watch App (Watch)
– This is the app on the watch. It handles the User Experience - Displays output and gathers input
– Written in C
• Smartphone running the Pebble App (Smartphone)
– This is the App on the phone that makes calls to the Webservice and handles the data that is
received.
– Where the OAuth connection is managed.
– Written in JavaScript
16. Watch App design basics
• Written in C
• Recommended App Structure- a standard C main() function and two functions to
help us organize the creation and destruction of all the Pebble SDK elements.
• Windows are composed of layers that represent components of the UI
– Layers are objects that can be displayed as visual objects, like text or images.
– Layers store information about its state necessary to draw or redraw
17. Components of a Pebble Application
AppMessage and AppSync
• AppMessage
– Bi-directional messaging from phone to watch
– Uses a push messaging system and a handler
– Limited in size of messages
– Available for use in PebbleKit-JS and native SDKs
• AppSync
– Built on top of the AppMessage
– Maintains a synced dictionary between phone and
WatchApp
– Callback routine available to notify app when
dictionary is changed
18. PebbleKit-JS and Native SDK
Getting data to and from the watch
• PebbleKit-JS – Javascript capability built into Pebble native
app that allows your application to communicate with the
internet
• Native SDK – Library to use in your mobile applications to
extend Pebble functionality
19. Watch App design basics
• Written in JavaScript
• Allows you to connect to a webservice
• Allows user to open a configuration screen on the phone
• Where oAuth and custom variables are stored that don’t fit into the watch UI
21. Design Patterns
• 4 Components in the Smartwatch App design
– Pebble Watch App (Watch)
• This is the app on the watch. It handles the User Experience - Displays output and gathers input
• Written in C
– Smartphone running the Pebble App (Smartphone)
• This is the App on the phone that makes calls to Salesforce and handles the data that is received from
Salesforce. This is also where the OAuth connection to Salesforce is managed.
• Written in JavaScript
– Salesforce1 Platform
• Handles the connection from the connected devices to the data in Salesforce,
• In our example the interface is written in JavaScript, the REST APIs are used
– Salesforce App
• The Standard web or mobile UI used to update records.
24. Getting Started/Resources
• Pebble
– (Guides, references, forums, etc.)
– cloudpebble.net – An online IDE for pebble development
• write, compile and install straight to your Pebble.
– #pebble in IRC
– Prerequisites – Familiarity with OAuth, C and JavaScript
• C concepts – Buffers, Pointers, Memory Management, etc
– You’re a long way from the Cloud.
Crowd involvement: - Who has a smart watch? Who thinks it just a hype?
The used to wear a watch… with smart phones, people have stopped wearing watches as much, because all a watch did was give you the time and date, from a functional point of view. Smart watches can add additional functionality to the same real estate space…. For example, who wears fitness trackers?
The real challenge for smartwatches is finding the use cases where they make sense
Crowd involvement: - Who has a smart watch? Who thinks it just a hype?
The used to wear a watch… with smart phones, people have stopped wearing watches as much, because all a watch did was give you the time and date, from a functional point of view. Smart watches can add additional functionality to the same real estate space…. For example, who wears fitness trackers?
The real challenge for smartwatches is finding the use cases where they make sense
WatchFace – No input mechanisms other than magnetometer and accelerometer
WatchFace – No input mechanisms other than magnetometer and accelerometer
Recommended app structure, specifically a standard C main() function and two other functions to help us organize the creation and destruction of all the Pebble SDK elements.
Responsible for Memory Management
WatchFace – No input mechanisms other than magnetometer and accelerometer
Recommended app structure, specifically a standard C main() function and two other functions to help us organize the creation and destruction of all the Pebble SDK elements.
Responsible for Memory Management
All this good stuff is from the developerpack and is in much greater detail there…
All this good stuff is from the developerpack and is in much greater detail there…
Flow
1) The code is initiated by the Pebble watch when the application is selected. The Pebble Watch App communicates over Bluetooth Low Energy (BLE) to your smartphone where the Pebble App on the smartphone receives the requests and checks for a valid connection to Salesforce. If there is no valid connection, the welcome screen continues to display. When you click a menu row on the watch, a message pops up instructing you to log into Salesforce through your smartphone by clicking on "SETTINGS" for the Salesforce1 Pebble Dashboard app.
2) Selecting "SETTINGS" will open the Salesforce login web page, which initiates the OAuth login procedure. This does not require any code in the JavaScript until the OAuth process completes. Upon completion of the OAuth sign-in, the Callback URL directs the Salesforce OAuth page to send the response to the Pebble App on the smartphone. This contains the OAuth token and other basic connect information that will be used for all future REST API calls.
3) Now with the token and connection details stored, the app is able search for the right reports, then use the Salesforce1 Analytics API to pull back data. In practice, you could make better use of Salesforce data by adding advanced formatting, such as placing multiple elements on a single line or using graphics to display information. For flexibility and installation simplicity this sample was written without any advanced customizations.
4) Once the data has been received and truncated to fit on the Pebble watch screen, it can be sent to the watch. It is important to be aware that when you want to send lots of data to the watch, you need to manage a handshake so you don’t lose records. This is done by setting the variable "load_report" to step through each row and let the Pebble watch pull the next record when it is ready for more data.
The Salesforce1 Pebble Dashboard is now displaying the data. Whenever you navigate away from the app, the data will ‘unload.’ It will refresh all the data whenever you return to the dashboards without the need to login again. If you want to force a specific report entry to reload, you can select and click on it by using the middle button on the watch. Timers can be used for regular interval refreshes.