Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Build your first wear app

2,207 views

Published on

Slide for GDG Meetup in Kyoto

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Build your first wear app

  1. 1. 1 Build your first Wear App 2019/02/10 GDG Meetup Kyoto @furusin_oriver
  2. 2. Who? Shinji Furukawa 古川 真次(ふるしん)     @furusin_oriver     furusin Compamy:FURYU.Inc Work:Android Engineer Product:for teenager girls app
  3. 3. We were sponsor of DroidKaigi
  4. 4. Contributors
  5. 5. Contributors
  6. 6. Contributors
  7. 7. My own wear project Watch Image Setter(ウォッチ写真セッター) https://play.google.com/store/apps/details?id=net.furusin.www.SelectedPhotoWatchFace Set image what you want for WatchFace background.
  8. 8. My own wear project Where is Wear? to Find Wear I lost with vibration
  9. 9. 9 Building WatchFace apps brief tips @furusin_oriver
  10. 10. Anyone has Android Wears?
  11. 11. Anyone has build your Wear Apps?
  12. 12. Android Wear? • What For? • Android OS for Wearable devices. (Smart Watch) • Name • Wear OS by Google(since 3/15/2018) • Sensors GPS / Accelerometer / Heart Rate etc... Connect with SmartPhone with Bluetooth(or WIFI).
  13. 13. Android Wear 4.4W(based w/ Android4.4) Android Wear 1.0(based w/ Android5.1) : : Android Wear 2.0 Wear OS by Google 1.0 Wear OS by Google 2.0 6/24/2014 (Google IO) 15/3/2018 8/2018 History
  14. 14. Modes • Interactive Mode • Active Mode • Always-on Mode • Ambient mode(Sleep Mode) • Save Battery • The background color scheme is limited to black, white and gray.
  15. 15. SDKs • Accessible to Android SDK • Support Library • com.google.android.support:wearable:2.4.0:No AndroidX yet • minSdkVersion 23 • Wearable UI Support Library • com.android.support:wear:26.0.0
  16. 16. Google sample code https://github.com/googlesamples/android-WatchFace
  17. 17. Getting started Creating Project Just Enable “Wear OS”
  18. 18. Select “Watch Face“ Getting started Creating Project
  19. 19. Select Style of WatchFace • Analog • Digital Getting started Creating Project
  20. 20. Run Hello,World! Just start created Project
  21. 21. Run Hello,World! Just start created Project Background Image
  22. 22. Run Hello,World! Just start created Project Background Image Hour Hand
  23. 23. Run Hello,World! Just start created Project Background Image Hour Hand Minute Hand
  24. 24. Run Hello,World! Just start created Project Background Image Hour Hand Minute Hand Second Hand
  25. 25. Run Hello,World! Just start created Project Background Image
  26. 26. Connect handheld and Virtual Wearable run $ adb -d forward tcp:5601 tcp:5601 select `Emulator` to connect ※handheld = Mobile devise (in Wearable, we call mobile devise “handheld”)
  27. 27. Let’s see codes!
  28. 28. AndroidManifest.xml
  29. 29. Key Class Engine CanvasWatchFaceService.Engine() CanvasWatchFaceService WatchFaceService WallpaperService Service android.support.wearable.watchface .WatchFaceService.Engine android.service.wallpaper .WallpaperService.Engine CanvasWatchFaceService Engine
  30. 30. implementation • onCreateEngine() • must be implemented. (similar as onCreate with handheld app) • onTimeTick() • basicary called every mins • called date, time or timezone changed as well • onAmbientModeChanged(Boolean) • called when enter or exits ambient mode • onDraw • draw WatchFace
  31. 31. How to set Image to Background?
  32. 32. for example... able to switch background image every seconds.
  33. 33. How to draw hands? set rotate degrees
  34. 34. How to draw hands? set rotate degrees for second
  35. 35. How to draw hands? set rotate degrees for second for minute
  36. 36. How to draw hands? set rotate degrees for second for minute for hour
  37. 37. How to draw hands? set rotate degrees for second for minute for hour set degrees drawLine
  38. 38. Any idea examples • Visible hanhold / wear batteries during active mode. • Check heart late every hour. • set backgroundImage your child’s photo(I do!)
  39. 39. In Addition • You can build Handheld apps coordinate with Wear Apps.(called Companion app) • to transfer datas from handheld to wearable, use `Asset` class.(Data Object) • Use Google Play Service API •CAUTION:GoogleApiClient has DEPRECATED! • from Google Play Service 11.8.0, GoogleApiCLient should be migrated to the GoogleApi class.
  40. 40. Conclusion • Very easy to create WatchFace. • able to connect from Handheld device to Virtual Wearable device. • able to access Android SDKs. • able to access any Sensors.
  41. 41. Conclusion • Very easy to create WatchFace. • able to connect from Handheld device to Virtual Wearable device. • able to access Android SDKs. • able to access any Sensors. • Enjoy Android Wear!
  42. 42. Extra
  43. 43. We are Hiring! • We desire Android Engineer! • Talk into me, please!
  44. 44. Next Event 京都Devかふぇ#5 〜Android Event 2019 リジェクトコン〜 Reject Conference of DroidKaigi(UnOfficial) 2019/03/01(Fri) 19:00〜

×