Upcoming SlideShare
Loading in...5

Integrating Clouds & Humans with Wearable Apps



As smart watches and other human-integrated devices make their way into the mainstream, developers will need to quickly ramp up to these new paradigms and interaction models. This session will dive ...

As smart watches and other human-integrated devices make their way into the mainstream, developers will need to quickly ramp up to these new paradigms and interaction models. This session will dive into the world of developing cloud-driven applications for wearables. Through copious code and examples you will learn the architecture and patterns for building cloud-based, wearable apps.



Total Views
Views on SlideShare
Embed Views



1 Embed 2

http://www.slideee.com 2



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Integrating Clouds & Humans with Wearable Apps Integrating Clouds & Humans with Wearable Apps Presentation Transcript

  • Integrating Clouds & Humans with Wearable Apps @_JamesWard Salesforce.com
  • Salesforce Wear Developer Packs • Six Open Source Developer Packs developer.salesforce.com/wear • Android Wear, Google Glass, Pebble, Samsung Gear, Myo, Nymi • Getting Started Guides, Sample Apps, and architecture overviews
  • Android Wear • Android-based Wearable SDK developer.android.com/wear • Wearables as companions to Android Phones • Glanceable notifications & interactions • Phones push to wearables • Moto360 & LG G View slide
  • Salesforce Wear Developer Pack for Android Wear • Quote Discount Approval Sample • Native Android Phone App • Salesforce Mobile Push • Gradle Build View slide
  • Sample: Quote Discount Approval Sales Rep Discount >= 20% trigger QuoteApproval on Quote (before insert, before update) {
  • One beautiful Gradle build does everything (almost) • Salesforce Metadata Deploy $ ./gradlew forceMetadataDeploy • Dependency Management dependencies { compile "com.force:SalesforceSDK:2.1.1-3" compile "com.android.support:support-v4:19.+" compile files("libs/wearable-preview-support.jar") } • Builds & runs the app $ ./gradlew installDebug
  • Architecture • Salesforce • Quotes on Opportunities • Approval Workflow: Quote with Discount >= 20% requires approval from manager • Trigger on Quote update/insert: creates approval process & sends mobile push message • Android Phone App • Receives push message • Creates notification on watch • Handles watch actions (Approve, Reject, Open)
  • Code Highlights - Trigger Messaging.PushNotification msg = new Messaging.PushNotification(); ! Map<String, Object> payload = new Map<String, Object>(); payload.put('ownerName', owner.Name); ... msg.setPayload(payload); ! String userId = result.actorIds[0]; Set<String> users = new Set<String>(); users.add(userId); ! msg.send('QuoteDiscountApproval', users);
  • Code Highlights - Push Receiver public class QPN implements PushNotificationInterface { ! @Override public void onPushMessageReceived(final Bundle bundle) { ! final QM quoteMessage = new QM(bundle); ! ... } ! } ! ! SalesforceSDKManager.getInstance() .setPushNotificationReceiver(new QPM(this));
  • Code Highlights - Wear Notification WearableNotifications.Builder wearableBuilder = new WearableNotifications.Builder(mainNotification); ! wearableBuilder .addPage(detailNotification) .addAction(rejectAction); ! mainNotification .setContentIntent(openPendingIntent); ! NotificationManagerCompat.from(context) .notify(1, wearableBuilder.build());
  • Code Highlights - Approve or Reject JSONObject approvalRequest = new JSONObject(); approvalRequest.put("actionType", action); approvalRequest.put("contextId", workItemId); approvalRequest.put("comments", comments); ! JSONArray requests = new JSONArray(); requests.put(approvalRequest); ! JSONObject json = new JSONObject(); json.put("requests", requests); ! StringEntity entity = new StringEntity(json.toString(), HTTP.UTF_8); entity.setContentType("application/json"); ! String url = "/services/data/" + c.getString(R.string.api_version) + "/process/approvals/"; ! final RestRequest restRequest = new RestRequest(RestRequest.RestMethod.POST, url, entity); ! QuoteDiscountApprovalSetup.client.sendAsync(restRequest, new RestClient.AsyncRequestCallback() { @Override public void onSuccess(RestRequest request, RestResponse result) { } ! @Override public void onError(Exception exception) { } } );
  • https://github.com/ developerforce/ WearablePack-AndroidWear