Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Developing for Wearables with Xamarin

Wird geladen in …3

Hier ansehen

1 von 48 Anzeige

Developing for Wearables with Xamarin

Herunterladen, um offline zu lesen

My colleague Jonah Hulselmans and me, gave a session about developing for Wearables like the Microsoft Band, Apple Watch and Android Wear with Xamarin. This sessions was given for MADN, a user group in Belgium that focuses on mobile development within the Microsoft Stack.

My colleague Jonah Hulselmans and me, gave a session about developing for Wearables like the Microsoft Band, Apple Watch and Android Wear with Xamarin. This sessions was given for MADN, a user group in Belgium that focuses on mobile development within the Microsoft Stack.


Weitere Verwandte Inhalte

Diashows für Sie (20)

Ähnlich wie Developing for Wearables with Xamarin (20)


Aktuellste (20)

Developing for Wearables with Xamarin

  1. 1. Wearables development with Xamarin
  2. 2. Who are we? Jonah Hulselmans @jonahhulselmans Gert Cominotto @GertCominotto gert-cominotto.be
  3. 3. • Xamarin • Microsoft Band • Apple Watch • Android Wear • Wearable Overview • Code reuse • Lessons learned / Heads up / Conclusion • Q&A Overview
  4. 4. Xamarin FormsXamarin
  5. 5. Microsoft Band
  6. 6. • Fitness Band, not a watch • Compatible with WP, Android & iOS • TILES TILES TILES!!! • Microsoft Health App (Important!) Microsoft Band
  7. 7. • Sensors • Accelerometer • Gyroscope • Distance • Heart Rate • Pedometer • Skin Temperature • UV • Band Contact (worn / not worn) • Calories • Galvanic Skin Response (Band2) • Ambient Light (Band2) • Barometer (Band2) • Altimeter (Band2) Microsoft Band
  8. 8. • Tools • SDK • Native SDK • Xamarin Components • Web Tile SDK • Cloud API (Health Data API) • Emulator? • No code runs on the band Developing for the Microsoft Band
  9. 9. What can you do with it? Access sensors Tiles Personalization
  10. 10. • Pair it with your phone / pc via Bluetooth Connecting to the device
  11. 11. Connection Demo
  12. 12. Accessing Sensors
  13. 13. DEMOSensors Demo
  14. 14. • Create & Manage Custom Tiles • Tile notifications • Dialogs • Messages • Custom layouts Tiles
  15. 15. Tiles Demo
  16. 16. • You can change your band’s colors and theme … Personalization
  17. 17. NO Demo!
  18. 18. • Background Tasks • Only on Windows Phone (8.1 & 10) • Custom Tile Events • Requires Microsoft Health App What else can you do?
  19. 19. Custom Tile Event Demo
  20. 20. Apple Watch
  21. 21. Apple Watch • 38mm and 42mm • Apple Pay • Fitness / Health • Notifications • Apps
  22. 22. Apple Watch sensors • Heart rate sensor • Accelerometer • Gyroscope • Ambient light sensor • …
  23. 23. Developing for the Apple Watch • xCode / Xamarin Studio / Visual Studio • Simulator • Xamarin.iOS • Watch OS 1 apps run on iPhone • (Watch OS 2 apps run on the watch)
  24. 24. What can you do with it? Notifications Glances App
  25. 25. Notifications Short looks Long looks
  26. 26. Notifications demo
  27. 27. Deploy apps to the Apple Watch • xCode and Xamarin Studio or Visual Studio • Apple Watch is paired to your iPhone • Provisioning profiles are setup correctly • Deploy the app to your iPhone
  28. 28. Communication • Call a method against the parent app • WKInterfaceController.OpenParentApplication (from watch extensions) • HandleWatchKitExtensionRequest (parent app) • Share a storage location with the parent iPhone app • NSUserDefaults • WormHoleSharp • https://github.com/Clancey/WormHoleSharp
  29. 29. Android Wear
  30. 30. • Stock Android! • Works with Android & iOS • Round or Square design • Focus on • Telling Time (Watch Faces) • Notifications • Google Now • Apps Android Wear
  31. 31. Android Wear Sensors (Varies per device)
  32. 32. • Tools • Emulator? • SDK • Native SDK Android • Xamarin.Android • Code runs on the device • Communicate with phone via API’s Developing for Android Wear
  33. 33. What can you do with it? Notifications Companion Apps Watch Faces
  34. 34. • Install Android Wear App on your device • Follow the steps on the device to Pair it Connecting to the device
  35. 35. Connection Demo
  36. 36. • Create Notifications • Add Actions • Wearable Specific Notifications / Actions Notifications
  37. 37. Notifications Demo
  38. 38. • Main differences: • Wearable apps are relatively small in size and functionality compared to phone apps. • Users don't download apps directly onto the wearable. • 2 Modes -> Interactive and Ambient Companion Apps
  39. 39. Companion App Demo
  40. 40. • MessageApi • Send messages to other nodes. (Small payloads) • DataApi • Send data to other nodes (Bigger payloads like assets) Communication Demo
  41. 41. Communication Demo
  42. 42. Wearable Overview Microsoft Band Apple Watch Android Wear Runs on Device No No Yes User Input No Yes (Touch & Voice) Yes (Touch & Voice) Sensors Yes Yes (Depending on Device) Phone Requirements Bluetooth LE (Windows, iOS & Android) iOS 8.2 Bluetooth LE (Android 4.3) Publishing No separate store WebTiles via Health App No separate store Deployed with Phone app No separate store Deployed with Phone app
  43. 43. • Not a great idea • Too different architecture and capabilities • Different way of connecting to devices • Very custom experience per wearable • But I deem it possible Code Reuse
  44. 44. • The Xamarin Nuget packages didn’t support UWP 10 at first • UWP App is coming in the next couple of weeks • By far the easiest to develop for • Excellent for when using sensors • With more background tasks capabilities, good future Lessons learned / Heads up / Conclusion Microsoft Band
  45. 45. • Feels sluggish (Watch OS 1) • Xamarin does not yet support watch OS 2 • (only on alpha channel) • Certificates + provisioning profiles • Disable “Enable device-specific builds” in the watchKitExtensions project Lessons learned / Heads up / Conclusion Apple Watch
  46. 46. • Android wearable emulator = utter crap! • If the Android emulator isn’t starting: • emulator -avd ExampleVDName -debug-all -noaudio -nocache -wipe-data -dns-server • Real device debugging isn’t much better… (long deploy times) Lessons learned / Heads up / Conclusion Android
  47. 47. Q & A

Hinweis der Redaktion

  • Visual Studio / Xamarin Studio
    No Emulator
    Native SDK for iOS, Android and Windows
    Xamarin Components for iOS and Android
    Web Tile SDK: for quickly delivering information to the Band from any Web source in just a few easy steps (bit.ly/1h94CjZ)
    Cloud API (Microsoft) for accessing RESTful APIs with comprehensive fitness and health data in an easy-to- consume JSON format (bit.ly/1MIBOL7)

    You have 2 ways to create an app for the Band:
    - You can create a WebTile, this is a tile that you can submit to the ‘tile store’ which can be accessed through the Microsoft Health App. These Tiles are small applications that don’t need a separate app on your phone because they run through the Microsoft Health App.
    - You can create an iOS, Android or Windows app and inside your app, you can create a tile on the Band. Your app is in charge of adding data / notifications to the band app, so all the logic from the band app is inside your phone app.

  • Dialogs:
    => Popups with content that can be dismissed.
    => Content of the popup is not saved to the wearable

    => These are notifications that are sent and stored in a specific tile, and a tile can keep up to 8 messages at a time. Messages can display a dialog, too. See this as a queue with a fixed size of 8. First in, first out when more than 8 messages are sent.

  • Background Task (Only Windows Phone 8.1 at the moment)
    Custom Tile Events (Requires Microsoft Health App)
  • Watch OS 1: With the original Apple Watch, apps were installed on the iPhone. From there, the Watch extension would remain on the phone, and an interface would be moved over to the watch. Then, the extension on the phone would connect to networks, process information, and transmit it back and forth to the interface on the Watch. It worked but it was limited, and it was slow.
    Watch OS 2: The extension moves over to join the interface, and to run natively on the Watch. Speed improvements because basic processing no longer requires a round trip to the phone. It increases functionality because apps can now access the Watch’s hardware.
  • Notifications
    Are a major use-case for the Apple Watch. Both local and remote notifications are supported. Interaction with notifications occurs in two stages, called Short- and Long-Look.
    Short looks appear briefly, giving the user just enough time to see what the notification is about and which app sent it.
    Long looks provide more detail about an incoming notification. The long look appears when the user’s wrist remains raised or when the user taps the short look.
    Glances are non-interactive, single-page UIs that are intended to provide summary or crucial data. When a glance is tapped it will open the main Watch app
  • Android Wear experience will be the same no matter what smartwatch you decide to slap on your wrist and, great news, it means your chosen tech-timepiece will work with any Android handset.

    You'll get notified for incoming texts, WhatsApp messages, tweets you're mentioned in, Facebook updates, emails and more. The whole shebang.

    Google Now powers a great deal of what you'll see popping up on your Android Wear smartwatch, but just like Google Now on your smartphone, it's still a work in progress.
    At times the intuitive notifications are genius – traffic concerns for your journey home, updated football scores for a team you search for a lot, the weather for the day ahead when you wake up ­– but you'll also see some right old random nonsense cropping up too.
    Google Now updates, like notifications about incoming messages, are presented in card style, with updates from the same app or regarding the same subject nicely stacked.

    Apps are installed through your phone (and the regular Google Play store). Apps that have Wear compatibility will either link up with your smartwatch and offer you control options (such as navigating your Spotify tracks or getting turn by turn directions from Google Maps)
    The apps, and default actions, are managed using the smartphone Android Wear app
  • Visual Studio / Xamarin Studio
    Emulator available
    Lazy, but very effective!
    Uses Notification.WearableExtender
    Custom Backgrounds
    Actions specific for Wear
    Remote Input
    Voice Input
    Predefined actions
    Pages, Stacking, and More!

    Companion App
    Android app that runs on a wearable
    New Themes
    New UI Widgets -> Wearable UI Library
    WearableListView •
  • Connect via USB cable
    Adjust USB Options on Mobile Phone to PTP
    Start Android Wear Emulator in Visual Studio
    adb -d forward tcp:5601 tcp:5601

    Real Device:
    adb forward tcp:4444 localabstract:/adb-hub
    adb connect localhost:4444
  • https://developer.android.com/training/wearables/notifications/creating.html
  • Wearable apps are relatively small in size and functionality compared to handheld apps. They contain only what makes sense on the wearable, which is usually a small subset of the corresponding handheld app. In general, you should carry out operations on the handheld when possible and send the results to the wearable.

    Users don't download apps directly onto the wearable. Instead, you bundle the wearable app inside the handheld app. When users install the handheld app, the system automatically installs the wearable app. However, for development purposes, you can still install the wearable app directly to the wearable.

    To conserve power on a wearable device, you can enable ambient mode for your Wear app.
    Devices transition from interactive to ambient mode when the user is idle on an activity or when the user covers the screen with their palm. Wearable apps that can transition into ambient mode are called always-on apps.
    The following describes the two modes of operation for always-on apps:
    Interactive Use full color with fluid animation in this mode. The app is also responsive to input.
    Ambient Render the screen with grayscale graphics and do not present any input cues in this mode. This display mode is only supported on devices running Android 5.1 or higher.
  • https://developer.android.com/training/wearables/apps/index.html

  • DataApi exposes an API for components to read or write data items and assets. A DataItem provides data storage with automatic syncing between the handheld and wearable. Asset is used for sending blobs of data such as images. You attach assets to DataItems and the system automatically takes care of the transfer for you.

    MessageApi exposes an API for components to send messages to other nodes. Messages should generally contain small payloads. You should use Assests with DataApi to store larger data.