See Androids Fighting
​ Dr. Holger Kremmin
​ Program Architect
​ hkremmin@salesforce.com
​ @kremminh
​ 
Integrating your Android Wear Watch with Salesforce
​ Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
​ This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed
or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-
looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any
statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new,
planned, or upgraded services or technology developments and customer contracts or use of our services.
​ The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new
functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our
operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any
litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our
relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our
service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger
enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our
annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter.
These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section
of our Web site.
​ Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available
and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features
that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Safe Harbor
Objectives
In this session you will learn about:
§ Anatomy of an Android Wear Application
§ Integration Options
§ Leveraging Salesforce Mobile SDK for Android
§ How to setup your Android Studio Project
§ Leverage Example Code
After this session you should have a good understanding to
quickly create a stunning Salesforce Android Wear application
Not covered
In this session you will not learn :
§ Oauth
§ Android application architecture
§ The Salesforce Rest API
§ Devolping for an Apple Watch …
Change pic
Agenda
§  Architectural Overview
§  Prerequisites
§  Bridged Notifications
§  Data API
§  Q & A
The Architecture of Android Wear
Architectural Overview – Android Wear
Message API
Data API
Node API
Wearable App
Companion App
Awesome
Companion App
Play Services
Wearable App
intents
Awesome App
Android OS
Android W
OS
Wearable
App
UI Building Blocks - Android Wear is different!
Users are used to tapping icons to launch apps. A typical Wear app adds a card to the stream at a contextually
relevant moment. It might have a button that opens a full screen view, but it just as well might not.
Contextual card Full Screen UI Watch Face
§  Bridged Notifications (no
development on Wear
Device!)
§  Contextual Notifications
§  2D Picker
§  Custom Layouts
§  Custom Watch Face
designs
Salesforce Mobile SDK
Push Notifications Container Wrappers Files MDM Policies
Enterprise Identity & Security
SmartStore Encrypted Database
SmartSync Data Management
OS UI Frameworks Any Web Framework
SalesforceSDKManager.initNative(getApplicationContext(), new KeyImpl(), DreamActivity.class);
SalesforceSDKManager.getInstance().setPushNotificationReceiver(new TravelPushNotification(this));
public class DreamActivity extends SalesforceActivity {
Architectural Overview – Salesforce Integration using GCM
Connected App Companion App
Notifications
Internet Internet
Architectural Overview – Direct Integration using REST-API
Internet
Message API
Data API
Node API
Prerequisites
What you need to do upfront
Setting Up Google Cloud Messaging (GCM)
​ Get a new configuration at developer.google.com (Developer account required)
123456789012
ABC123JKL4567fyzu89012hjr
What you get:
•  Package Name
•  Server API Key
•  Sender ID
Com.dreamforce
Configure the Connected App in Salesforce
​ At least a Developer Org & Admin rights required
from Google
A lot of keys...What goes Where?
Key Source Destination
Server API Key Google Developer Salesforce Connected App
-> Mobile App Settings
-> Key for Server Applications
(API Key)
Sender ID Google Developer Resource File:
<string
name="androidPushNotificationClientId">
123456789012
</string>
Android Package Name Google Developer Resource File:
<string name="app_package">com.example.app
</string>
Consumer Key Salesforce Resource File:
<string name="remoteAccessConsumerKey">
3MVG9xOCXq...
</string>
Setting Up Android Studio
§  Usage of Android Studio is
highly recommended
§  Create a Library project for
the Mobile SDK so you can
reference it easily from your
projects
§  Good Practice: Shared
project for constants,
resources etc.
§  Gradle as Build System
§  Use real devices for
debugging instead of using
Emulators
The Notification API
Bring your approval process to your Smart Watch
Demo
Sample Workflow
Create
Travel Request
Salesforce
Appex Trigger:
Approval Process
Appex Trigger:
Push Notification
GCM:
Push Notification
Mobile Phone:
Push Notification
Wear:
Notification Cards
GCM
Mobile
Phone
Wear
Device
Wear:
Approve / Reject
Mobile Phone:
Send Notification
GCM:
Send Notification
Approve/
Reject
Apex Code Snippet – Create & Send Notification/ Message
// send the notification
Messaging.PushNotification msg = new Messaging.PushNotification();
Map<String, Object> payload = new Map<String, Object>();
payload.put('ownerName', owner.Name);
payload.put('ownerFullPhotoUrl', owner.FullPhotoUrl);
...
msg.setPayload(payload);
// The approver's Id
String userId = result.actorIds[0];
Set<String> users = new Set<String>();
users.add(userId);
msg.send('Android_Wear', users);
Create Message Object
Create Payload
Add Payload to Message
Add target Users
Send Message to target
Users
Implement PushNotificationInterface
​ PushNotificationInterface is a Mobile SDK Android interface for
handling push notifications. PushNotificationInterface has a
single method, onPushMessageReceived(Bundle message).
public class TravelPushNotification implements PushNotificationInterface {
...
@Override
public void onPushMessageReceived(final Bundle bundle) {
... //create an async task if you perform network tasks etc!
Eg. Build your notification HERE
Create Notifications with the Notification Builder
​ The v4 support library allows you to create notifications using the latest
notification features such as action buttons and large icons.
​ To create a notification with the support library, you create an instance of
NotificationCompat.Builder and issue the notification by passing it to notify()
// Main notification
NotificationCompat.Builder mainNotification = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.s1_icon)
.setContentTitle(travelMessage.ownerName)
.setContentText(“Travel approval required: " + travelMessage.travelName);
...
// Open Card
mainNotification.setContentIntent(openPendingIntent);
NotificationManagerCompat.from(context).notify(1, mainNotification.build());
Add Wearable Features For a Notification
​ If you ever need to add wearable-specific options to a notification, such
as specifying additional pages of content or letting users dictate a text
response with voice input, you can use the
NotificationCompat.WearableExtender class to specify the options.
WearableExtender wearableExtender = new WearableExtender()
.addAction(approveAction)
.addAction(rejectAction)
.addPage(detailNotification);
mainNotification.extend(wearableExtender);
Demo
23
The Data API
Sync your data between the Smart Watch and the Companion App
Sample Workflow
Record
Speech
Salesforce
Create
DataItem
Sync with Mobile
Sync with Wear Send Rest Object
Show
Chatter Post
GCM
Mobile
Phone
Wear
Device
The Wearable Data Layer API is part of Google Play services and provides a
communication channel for your companion and wearable apps. The API
supports the synchronization of data objects over the wire and eventing.
The Data API
A DataItem provides data storage with
automatic syncing between the
handheld and wearable.
Asset objects are for sending binary
blobs of data, such as images. You
attach assets to data items and the
system automatically takes care of the
transfer for you, conserving Bluetooth
bandwidth by caching large assets to
avoid re-transmission.
​ WearableListenerService lets you
listen for important data layer events in a
service. The system manages the lifecycle
of the WearableListenerService
​ DataListener lets you listen for
important data layer events when an
activity is in the foreground. Lets you listen
for changes only when the user is actively
using your app.
​ You can use the ChannelApi class to
transfer large data items, such as music
and movie files, from a handheld to a
wearable device.
​ The MessageApi class can send
messages and is good for remote
procedure calls (RPC), such as controlling
a handheld's media player from the
wearable or starting an intent on the
wearable from the handheld. Messages
are also great for one-way requests or for a
request/response communication model.
Data Events Channel / Message
For Demonstration of the Data Sync we create a full screen
UI wearable app
​ An Android wear application is nearly identical to a normal smartphone app. In our example we
will use the Data API to exchange Data between the Wear device and the companion app running
on the smart phone. For our example we could also use the Message API.
​ Extend the MainActivity if you want to listen to data events on the UI Thread.
// Main Activity
public class MainActivity extends Activity
implements ConnectionCallbacks, OnConnectionFailedListener,
DataApi.DataListener, MessageApi.MessageListener, NodeApi.NodeListener {
... Your App Code goes here
@Override
public void onDataChanged(DataEventBuffer dataEvents) {
....
If you want to listen to Data change Events
Speech Recognition
​ Voice actions (System- or App provided “OK Google, …) and the system's built-in Speech
Recognizer activity can be used to obtain speech input from users.
// Create an intent that can start the Speech Recognizer activity
private void displaySpeechRecognizer() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
// Start the activity, the intent will be populated with the speech text
startActivityForResult(intent, SPEECH_REQUEST_CODE);
}
// invoked when the Speech Recognizer returns, extract the speech text from the intent.
@Override
protected void onActivityResult(int requestCode, int resultCode,Intent data) {
if (resultCode == RESULT_OK) {
List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
chatterText = results.get(0);
<create & send the data event>
}
Sending Data
​ A DataItem defines the data interface that the system uses to synchronize data between handhelds and
wearables. A DataItem generally consists of the following items:
§  Payload - A byte array, which you can set with whatever data you wish, allowing you to do your own object
serialization and deserialization. The size of the payload is limited to 100KB.
§  Path - A unique string that must start with a forward slash (for instance, "/salesforce/wearable/chatter")
// Create a data map and put data in it
private void createChatterData(String post) {
//Create the data request object
PutDataMapRequest putDataMapReq = PutDataMapRequest.create (“/chatter ");
putDataMapReq.getDataMap().putString(CHATTER_KEY, post);
PutDataRequest putDataReq = putDataMapReq.asPutDataRequest();
// Adds a DataItem to the Android Wear network. à synchronized across all devices
PendingResult<DataApi.DataItemResult> pendingResult =
Wearable.DataApi.putDataItem(mGoogleApiClient, putDataReq);
}
...
A DataLayerService will listen on all data events
​ The data layer synchronizes and sends data across the handheld and wearable, you normally want to listen
for important events, such as when data items are created, are received, etc. Options:
§  Create a service that extends WearableListenerService.
§  Create an activity that implements DataApi.DataListener.
public class DataLayerListenerService extends WearableListenerService {
/.../
@Override
public void onDataChanged(DataEventBuffer dataEvents) {
if (!mGoogleApiClient.isConnected()... //check for connectivity!!!
// Loop through the events for (DataEvent event : dataEvents) {
Uri uri = event.getDataItem().getUri();
String path = uri.getPath();
if (COUNT_PATH.equals(path)) {
// get the payload
byte[] payload = uri.toString().getBytes();
// *Chatter something J
postChatterMessage(payload);
...
Leveraging the
MobileSDK
(Authentication, Rest
Calls etc…)
* See https://github.com/forcedotcom/JavaChatterRESTApi by Jasper Roel
Speech Recognition is a great feature, but...
Hello Chatter
Dreamforce is
Awesome
Willkommen auf
der Dreamforce
Who needs the
Apple Watch?
Who will win
the Super
Bowl?
Key Takeaways
§  Keep your Wear UI as simple as possible!!!
§  Always test on real devices
§  The Salesforce Mobile SDK and Connected Apps handle most of the
connection complexity for your application
§  Wear Devices are mainly informative devices or to automatically
collect data
§  The Notification is a great and simple way to expand your existing
Android app to Wear Watches without the need to code a custom
Wear app
Share Your Feedback, and Win a GoPro!
3
Earn a GoPro prize entry for each completed
surveyTap the bell to take a survey2Enroll in a session1
Thank you
Thank you
Backup Slides
UI Building Blocks - Android Wear is different!
Users are used to tapping icons to launch apps. A typical Wear app adds a card to the stream at a contextually
relevant moment. It might have a button that opens a full screen view, but it just as well might not.
Application Type Device
Devlopment
Contextual card in the
stream
Bridged notifications, such as new message notifications, are pushed to the
wearable from the connected handheld using standard Android notifications.
They require very little or no Wear-specific code.
✗
Contextual notifications, such as an exercise card that appears when you
begin running, are generated locally on the wearable and appear at
contextually relevant moments. You can do more with this kind of card than
with a notification bridged from the handheld.
✔
Full screen UI app: 2D Picker is a design pattern that allows the user to select from a set of items,
such as to select an artist then an album. We recommend using this pre-built
component from the SDK whenever relevant.
✔
Custom layouts are also possible where apps need to extend beyond the
basic card/stream metaphor, such as to present a graph or map. ✔
Keep your app always-on if you have information that refreshes or stays
relevant, without draining the battery. ✔
Watch Face Android Wear supports custom watch faces with designs that can show
contextually relevant information to users. ✔

See Androids Fighting: Connect Salesforce with Your Android Wear Watch

  • 1.
    See Androids Fighting ​ Dr.Holger Kremmin ​ Program Architect ​ hkremmin@salesforce.com ​ @kremminh ​  Integrating your Android Wear Watch with Salesforce
  • 2.
    ​ Safe harbor statementunder the Private Securities Litigation Reform Act of 1995: ​ This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward- looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. ​ The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. ​ Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements. Safe Harbor
  • 3.
    Objectives In this sessionyou will learn about: § Anatomy of an Android Wear Application § Integration Options § Leveraging Salesforce Mobile SDK for Android § How to setup your Android Studio Project § Leverage Example Code After this session you should have a good understanding to quickly create a stunning Salesforce Android Wear application
  • 4.
    Not covered In thissession you will not learn : § Oauth § Android application architecture § The Salesforce Rest API § Devolping for an Apple Watch … Change pic
  • 5.
    Agenda §  Architectural Overview § Prerequisites §  Bridged Notifications §  Data API §  Q & A
  • 6.
    The Architecture ofAndroid Wear
  • 7.
    Architectural Overview –Android Wear Message API Data API Node API Wearable App Companion App Awesome Companion App Play Services Wearable App intents Awesome App Android OS Android W OS Wearable App
  • 8.
    UI Building Blocks- Android Wear is different! Users are used to tapping icons to launch apps. A typical Wear app adds a card to the stream at a contextually relevant moment. It might have a button that opens a full screen view, but it just as well might not. Contextual card Full Screen UI Watch Face §  Bridged Notifications (no development on Wear Device!) §  Contextual Notifications §  2D Picker §  Custom Layouts §  Custom Watch Face designs
  • 9.
    Salesforce Mobile SDK PushNotifications Container Wrappers Files MDM Policies Enterprise Identity & Security SmartStore Encrypted Database SmartSync Data Management OS UI Frameworks Any Web Framework SalesforceSDKManager.initNative(getApplicationContext(), new KeyImpl(), DreamActivity.class); SalesforceSDKManager.getInstance().setPushNotificationReceiver(new TravelPushNotification(this)); public class DreamActivity extends SalesforceActivity {
  • 10.
    Architectural Overview –Salesforce Integration using GCM Connected App Companion App Notifications Internet Internet
  • 11.
    Architectural Overview –Direct Integration using REST-API Internet Message API Data API Node API
  • 12.
  • 13.
    Setting Up GoogleCloud Messaging (GCM) ​ Get a new configuration at developer.google.com (Developer account required) 123456789012 ABC123JKL4567fyzu89012hjr What you get: •  Package Name •  Server API Key •  Sender ID Com.dreamforce
  • 14.
    Configure the ConnectedApp in Salesforce ​ At least a Developer Org & Admin rights required from Google
  • 15.
    A lot ofkeys...What goes Where? Key Source Destination Server API Key Google Developer Salesforce Connected App -> Mobile App Settings -> Key for Server Applications (API Key) Sender ID Google Developer Resource File: <string name="androidPushNotificationClientId"> 123456789012 </string> Android Package Name Google Developer Resource File: <string name="app_package">com.example.app </string> Consumer Key Salesforce Resource File: <string name="remoteAccessConsumerKey"> 3MVG9xOCXq... </string>
  • 16.
    Setting Up AndroidStudio §  Usage of Android Studio is highly recommended §  Create a Library project for the Mobile SDK so you can reference it easily from your projects §  Good Practice: Shared project for constants, resources etc. §  Gradle as Build System §  Use real devices for debugging instead of using Emulators
  • 17.
    The Notification API Bringyour approval process to your Smart Watch Demo
  • 18.
    Sample Workflow Create Travel Request Salesforce AppexTrigger: Approval Process Appex Trigger: Push Notification GCM: Push Notification Mobile Phone: Push Notification Wear: Notification Cards GCM Mobile Phone Wear Device Wear: Approve / Reject Mobile Phone: Send Notification GCM: Send Notification Approve/ Reject
  • 19.
    Apex Code Snippet– Create & Send Notification/ Message // send the notification Messaging.PushNotification msg = new Messaging.PushNotification(); Map<String, Object> payload = new Map<String, Object>(); payload.put('ownerName', owner.Name); payload.put('ownerFullPhotoUrl', owner.FullPhotoUrl); ... msg.setPayload(payload); // The approver's Id String userId = result.actorIds[0]; Set<String> users = new Set<String>(); users.add(userId); msg.send('Android_Wear', users); Create Message Object Create Payload Add Payload to Message Add target Users Send Message to target Users
  • 20.
    Implement PushNotificationInterface ​ PushNotificationInterface isa Mobile SDK Android interface for handling push notifications. PushNotificationInterface has a single method, onPushMessageReceived(Bundle message). public class TravelPushNotification implements PushNotificationInterface { ... @Override public void onPushMessageReceived(final Bundle bundle) { ... //create an async task if you perform network tasks etc! Eg. Build your notification HERE
  • 21.
    Create Notifications withthe Notification Builder ​ The v4 support library allows you to create notifications using the latest notification features such as action buttons and large icons. ​ To create a notification with the support library, you create an instance of NotificationCompat.Builder and issue the notification by passing it to notify() // Main notification NotificationCompat.Builder mainNotification = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.s1_icon) .setContentTitle(travelMessage.ownerName) .setContentText(“Travel approval required: " + travelMessage.travelName); ... // Open Card mainNotification.setContentIntent(openPendingIntent); NotificationManagerCompat.from(context).notify(1, mainNotification.build());
  • 22.
    Add Wearable FeaturesFor a Notification ​ If you ever need to add wearable-specific options to a notification, such as specifying additional pages of content or letting users dictate a text response with voice input, you can use the NotificationCompat.WearableExtender class to specify the options. WearableExtender wearableExtender = new WearableExtender() .addAction(approveAction) .addAction(rejectAction) .addPage(detailNotification); mainNotification.extend(wearableExtender);
  • 23.
  • 24.
    The Data API Syncyour data between the Smart Watch and the Companion App
  • 25.
    Sample Workflow Record Speech Salesforce Create DataItem Sync withMobile Sync with Wear Send Rest Object Show Chatter Post GCM Mobile Phone Wear Device
  • 26.
    The Wearable DataLayer API is part of Google Play services and provides a communication channel for your companion and wearable apps. The API supports the synchronization of data objects over the wire and eventing. The Data API A DataItem provides data storage with automatic syncing between the handheld and wearable. Asset objects are for sending binary blobs of data, such as images. You attach assets to data items and the system automatically takes care of the transfer for you, conserving Bluetooth bandwidth by caching large assets to avoid re-transmission. ​ WearableListenerService lets you listen for important data layer events in a service. The system manages the lifecycle of the WearableListenerService ​ DataListener lets you listen for important data layer events when an activity is in the foreground. Lets you listen for changes only when the user is actively using your app. ​ You can use the ChannelApi class to transfer large data items, such as music and movie files, from a handheld to a wearable device. ​ The MessageApi class can send messages and is good for remote procedure calls (RPC), such as controlling a handheld's media player from the wearable or starting an intent on the wearable from the handheld. Messages are also great for one-way requests or for a request/response communication model. Data Events Channel / Message
  • 27.
    For Demonstration ofthe Data Sync we create a full screen UI wearable app ​ An Android wear application is nearly identical to a normal smartphone app. In our example we will use the Data API to exchange Data between the Wear device and the companion app running on the smart phone. For our example we could also use the Message API. ​ Extend the MainActivity if you want to listen to data events on the UI Thread. // Main Activity public class MainActivity extends Activity implements ConnectionCallbacks, OnConnectionFailedListener, DataApi.DataListener, MessageApi.MessageListener, NodeApi.NodeListener { ... Your App Code goes here @Override public void onDataChanged(DataEventBuffer dataEvents) { .... If you want to listen to Data change Events
  • 28.
    Speech Recognition ​ Voice actions(System- or App provided “OK Google, …) and the system's built-in Speech Recognizer activity can be used to obtain speech input from users. // Create an intent that can start the Speech Recognizer activity private void displaySpeechRecognizer() { Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); // Start the activity, the intent will be populated with the speech text startActivityForResult(intent, SPEECH_REQUEST_CODE); } // invoked when the Speech Recognizer returns, extract the speech text from the intent. @Override protected void onActivityResult(int requestCode, int resultCode,Intent data) { if (resultCode == RESULT_OK) { List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); chatterText = results.get(0); <create & send the data event> }
  • 29.
    Sending Data ​ A DataItemdefines the data interface that the system uses to synchronize data between handhelds and wearables. A DataItem generally consists of the following items: §  Payload - A byte array, which you can set with whatever data you wish, allowing you to do your own object serialization and deserialization. The size of the payload is limited to 100KB. §  Path - A unique string that must start with a forward slash (for instance, "/salesforce/wearable/chatter") // Create a data map and put data in it private void createChatterData(String post) { //Create the data request object PutDataMapRequest putDataMapReq = PutDataMapRequest.create (“/chatter "); putDataMapReq.getDataMap().putString(CHATTER_KEY, post); PutDataRequest putDataReq = putDataMapReq.asPutDataRequest(); // Adds a DataItem to the Android Wear network. à synchronized across all devices PendingResult<DataApi.DataItemResult> pendingResult = Wearable.DataApi.putDataItem(mGoogleApiClient, putDataReq); } ...
  • 30.
    A DataLayerService willlisten on all data events ​ The data layer synchronizes and sends data across the handheld and wearable, you normally want to listen for important events, such as when data items are created, are received, etc. Options: §  Create a service that extends WearableListenerService. §  Create an activity that implements DataApi.DataListener. public class DataLayerListenerService extends WearableListenerService { /.../ @Override public void onDataChanged(DataEventBuffer dataEvents) { if (!mGoogleApiClient.isConnected()... //check for connectivity!!! // Loop through the events for (DataEvent event : dataEvents) { Uri uri = event.getDataItem().getUri(); String path = uri.getPath(); if (COUNT_PATH.equals(path)) { // get the payload byte[] payload = uri.toString().getBytes(); // *Chatter something J postChatterMessage(payload); ... Leveraging the MobileSDK (Authentication, Rest Calls etc…) * See https://github.com/forcedotcom/JavaChatterRESTApi by Jasper Roel
  • 31.
    Speech Recognition isa great feature, but... Hello Chatter Dreamforce is Awesome Willkommen auf der Dreamforce Who needs the Apple Watch? Who will win the Super Bowl?
  • 32.
    Key Takeaways §  Keepyour Wear UI as simple as possible!!! §  Always test on real devices §  The Salesforce Mobile SDK and Connected Apps handle most of the connection complexity for your application §  Wear Devices are mainly informative devices or to automatically collect data §  The Notification is a great and simple way to expand your existing Android app to Wear Watches without the need to code a custom Wear app
  • 33.
    Share Your Feedback,and Win a GoPro! 3 Earn a GoPro prize entry for each completed surveyTap the bell to take a survey2Enroll in a session1
  • 34.
  • 35.
  • 36.
    UI Building Blocks- Android Wear is different! Users are used to tapping icons to launch apps. A typical Wear app adds a card to the stream at a contextually relevant moment. It might have a button that opens a full screen view, but it just as well might not. Application Type Device Devlopment Contextual card in the stream Bridged notifications, such as new message notifications, are pushed to the wearable from the connected handheld using standard Android notifications. They require very little or no Wear-specific code. ✗ Contextual notifications, such as an exercise card that appears when you begin running, are generated locally on the wearable and appear at contextually relevant moments. You can do more with this kind of card than with a notification bridged from the handheld. ✔ Full screen UI app: 2D Picker is a design pattern that allows the user to select from a set of items, such as to select an artist then an album. We recommend using this pre-built component from the SDK whenever relevant. ✔ Custom layouts are also possible where apps need to extend beyond the basic card/stream metaphor, such as to present a graph or map. ✔ Keep your app always-on if you have information that refreshes or stays relevant, without draining the battery. ✔ Watch Face Android Wear supports custom watch faces with designs that can show contextually relevant information to users. ✔