Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby is watching

Ruby is watching

An introduction on developing WatchKit and Android Wear apps using RubyMotion. We'll learn about the differences between both platforms, what kind of possibilities the smartwatches bring to extending your application and how to share some code for your watch app between both iOS and Android versions.

9d2ea021919ff81e02d48530aae191bd?s=128

Boris Bügling

July 02, 2015
Tweet

Transcript

  1. RUBY IS ⌚ING #INSPECT 2015 ! BORIS BÜGLING - @NEONACHO

  2. None
  3. COCOAPODS

  4. CONTENTFUL

  5. None
  6. !!!!

  7. AGENDA ▸ ᴡᴀᴛᴄʜ ▸ Android Wear ▸ Developing for both

    with RubyMotion ▸ Building a simple app
  8. ᴡᴀᴛᴄʜ

  9. WATCHOS 1.X ▸ Notifications ▸ Glances ▸ WatchKit apps

  10. NOTIFICATIONS

  11. GLANCES

  12. WATCHKIT

  13. WATCHOS 2.X ▸ Apps run natively on the watch ▸

    Custom complications
  14. !!!

  15. None
  16. COMPLICATIONS

  17. ANDROID WEAR

  18. ANDROID WEAR ▸ Enhanced Notifications ▸ Wearable Apps

  19. ENHANCED NOTIFICATIONS

  20. None
  21. WEARABLE APPS

  22. => PRETTY MUCH THE SAME

  23. => RUBYMOTION

  24. None
  25. RAKEFILE Motion::Project::App.setup do |app| [...] app.target 'WatchApp', :watchapp end

  26. RESOURCES ▸ Interface.storyboard ▸ Asset catalogs

  27. WATCHAPP/RAKEFILE [...] require 'ib/tasks' IB::RakeTask.new do |project| project.resource_directories = ['watch_app']

    end
  28. EXTENSION DELEGATE class ExtensionDelegate def applicationDidFinishLaunching [...] end def applicationDidBecomeActive

    [...] end def applicationWillResignActive [...] end end
  29. INTERFACE CONTROLLER class InterfaceController < WKInterfaceController extend IB def initWithContext(context)

    if super [...] self end end def willActivate [...] end def didDeactivate [...] end end
  30. WKINTERFACECONTROLLER ▸ Navigation ▸ Presentation ▸ Handoff ▸ Handle notification

    actions ▸ Communicate with parent app
  31. RUNNING THE APP IN THE SIM rake watch

  32. ANDROID WEAR ISN'T REALLY SUPPORTED, YET

  33. BUILDING A SIMPLE APP

  34. None
  35. WATCHPRESENTER ▸ Remote controls Deckset instead ▸ Direct connection to

    the Mac ▸ Shows a preview of the slides ▸ Measures heartrate to display the "most exciting" slide ▸ Taps you if you're running out of time
  36. MULTIPEER CONNECTIVITY!

  37. AVAILABLE FRAMEWORKS

  38. CFNetwork.framework ClockKit.framework Contacts.framework CoreData.framework CoreFoundation.framework CoreGraphics.framework CoreLocation.framework CoreMotion.framework EventKit.framework Foundation.framework

  39. HealthKit.framework HomeKit.framework ImageIO.framework MapKit.framework MobileCoreServices.framework PassKit.framework Security.framework UIKit.framework WatchConnectivity.framework WatchKit.framework

  40. BT APIS ARE PRIVATE :(

  41. OTHER OPTIONS ▸ NSURLSession via Wi-Fi ▸ WatchConnectivity.framework to talk

    via the phone
  42. HEALTHKIT.FRAMEWORK ▸ not usable in the Watch simulator

  43. TAPTIC ENGINE typedef NS_ENUM(NSInteger, WKHapticType) { WKHapticTypeNotification, WKHapticTypeDirectionUp, WKHapticTypeDirectionDown, WKHapticTypeSuccess,

    WKHapticTypeFailure, WKHapticTypeRetry, WKHapticTypeStart, WKHapticTypeStop, WKHapticTypeClick } WK_AVAILABLE_WATCHOS_ONLY(2.0); WKInterfaceDevice.currentDevice.playHaptic(WKHapticTypeStart)
  44. BUT ALSO NOT USABLE IN THE SIM

  45. DEMO

  46. TIPS

  47. printf DEBUGGING IS GREAT!

  48. MMWORMHOLE ▸ watchOS 1.0: CFNotificationCenter ▸ watchOS 2.0: WatchConnectivity.framework

  49. FORCE QUIT APPS ▸ Long press until "reboot" menu ▸

    Long press again
  50. IF IN DOUBT, REBOOT THE WATCH :)

  51. WHAT HAVE WE LEARNED? ▸

  52. THANK YOU!

  53. ▸ https://developer.apple.com/watch/human-interface-guidelines/ ▸ https://developer.apple.com/library/prerelease/watchos/ documentation/General/Conceptual/AppleWatch2TransitionGuide/ ▸ https://developer.android.com/wear/index.html ▸ https://github.com/shu223/watchOS-2-Sampler ▸

    http://www.kristinathai.com/category/watchkit/ ▸ http://www.slideshare.net/peterfriese/introduction-to-android- wear
  54. None
  55. @NeoNacho boris@contentful.com http://buegling.com/talks