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

Developing i'm Watch apps - Droidcon London 2013

Developing i'm Watch apps - Droidcon London 2013

"Wearable computing is turning out to be the next big thing. Most of the major players in the smartphone market are hurrying up to release smartwatches, wearable sensors, glasses, and a variety of the most diverse kinds of devices. Launched in 2012 and based on a customized version of Android, the i’m Watch is one of the first smart watches available on the market, and the most complete feature-wise.

In this session, you’ll get an overview of what you need to develop apps for the i’m Watch (spoiler alert: you probably already have everything you need!), you’ll learn what a smart watch is supposed to do and what the main differences in user experience and expectations are from what you’re used to on phones and tablets.

The session will also briefly cover the libraries that will make your life easier and help you create outstanding apps for the i’m Watch.

Why not find out more about this great new technology?"

This deck was presented in the main conference at the Droidcon London 2013, in the "Not phones" track. This is basically an extended version of the barcamp speech that was presented at the Droidcon Paris 2013.

You can watch the presentation video here: http://skillsmatter.com/podcast/home/developing-im-watch-apps/hg-8579

Sebastiano Poggi

October 24, 2013
Tweet

More Decks by Sebastiano Poggi

Other Decks in Programming

Transcript

  1. Developing i'm Watch apps From zero to hero in less

    than an hour Sebastiano Poggi Software Engineer, i'm Spa Droidcon London 2013
  2. What is the i'm Watch? #imdeveloper Runs a custom Android

    version Bluetooth Works with Android phones, iPhones and BB10 phones It's made in Italy (for real!) · · · · 3/31
  3. i'm Droid #imdeveloper Custom version of Android Smartwatch-optimized Android 1.6

    (API level 4) Support Library v4 (Fragments, ViewPagers, Loaders, etc) i'm Watch-specific libraries: · · · · · RTLHelper Overlay Menu Sensors API Bluetooth API ... - - - - - 4/31
  4. Because it's fun, because it's easy, and because... Why develop

    i'm Watch apps? #imdeveloper Over 30000 i'm Watch users 100 apps on i'market: plenty of opportunities Premium hardware, premium users Monetization is easy i'm Watch users love (and pay for) apps: great ROIs · · · · · 5/31
  5. Gives Android developers the tools, knowledge and support to develop

    i'm Watch apps. The i'm Developer program #imdeveloper Getting started, step-by-step instructions Downloads: ADB build of i'm Droid, drivers, etc i'm Watch libraries and sample code Top-notch developer technical support i'm Spa GitHub account: https://github.com/imspa · · · · · 6/31
  6. Porting Doodle Grub: a case study #imdeveloper Multiplatform game, over

    8 million downloads. Porting from Android to the i'm Watch took less than one man-week. Listen to a first-hand account from Pixowl at the Democamp. Launching today on i'market! · · · · 7/31
  7. Doodle Grub, our snake game, was really easy to port

    with almost out of the box compatibility. The game takes a new dimension of fun with i'm Watch as playing it with the accelerometer on your wrist is a very entertaining experience. #imdeveloper “ ” Sébastien Borget Pixowl 8/31
  8. Developing for the i'm Watch #imdeveloper Android 1.6 SDK (API

    level 4) Code editor: Device/emulator to test on ADB not available on OS user builds ADB-over-IP: needs setup (RNDIS)! · · Eclipse IntelliJ IDEA Android Studio Any text editor (VIM, ...) - - - - · · · a d b c o n n e c t 1 0 . 0 . 0 . 1 6 8 10/31
  9. Set up an i'm Watch emulator #imdeveloper Created in the

    AVD Manager Emulator configuration: No i'm Watch UI customizations No i'm Watch APIs Test on devices! Hint: 99€ (~£85) special price for Droidcon · · Android 1.6 (API level 4) Display: 240x239 (bug with square displays) Abstracted density: 120 dpi (for readability) RAM size: 128 MB, Max VM app heap size: 24 MB SD card size: 4 GiB - - - - - · · · · That's 60% off! 11/31
  10. The i'm Watch runs Android: lots of documentation and resources

    available for the Android SDK. Great resources: Use your Android skills #imdeveloper Android Developers website http://d.android.com i'm Developer website http://d.imsmart.com Stack Overflow http://stackoverflow.com Books (Commonsware's The busy coder's guide to Android development, Reto Meier's Professional Android 4 Application Development, ...) · · · · 12/31
  11. i'm Watch user expectations #imdeveloper Companion device to the smartphone

    HUD for the phone Focus on the notifications and quick access to essential information Optimize and rationalize resources! No options menu (O v e r l a y M e n u s and i'm Cloud instead) Apps configuration on i'm Cloud No IMEs · · · · · · · 14/31
  12. Laser-focused #imdeveloper Laser-focused on the main use case Most apps

    have just one A c t i v i t y KISS approach (Keep It Simple, Stupid!) Small screen: only essential info · · · · 15/31
  13. Quite Android #imdeveloper Android design patterns! Use V i e

    w P a g e r , F r a g m e n t s, L o a d e r s etc Simple and minimalistic UI, Holo-esque: · · · Black backgrounds, white and light gray content One accent color throughout the app Zero chrome (content-first) - - - 16/31
  14. Apps configuration - #1 #imdeveloper Apps configuration done on i'm

    Cloud Syncing managed by the i'm Agent Also syncs 3rd party apps data (i'm Droid 2.2.0+) Configuration JSON declared on the Developer Console: 10 seconds to process JSON and update · · · · · 18/31
  15. Apps configuration - #2 #imdeveloper B r o a d

    c a s t R e c e i v e r in the manifest: Sync data passed as raw JSON, in a string extra of the U P D A T E intent: · < r e c e i v e r a n d r o i d : n a m e = " . R e c e i v e r " > < i n t e n t - f i l t e r > < a c t i o n a n d r o i d : n a m e = " i t . i m w a t c h . i m c l o u d . U P D A T E " / > < a c t i o n a n d r o i d : n a m e = " i t . i m w a t c h . i m c l o u d . U P D A T E _ E X T E N D " / > < / i n t e n t - f i l t e r > < / r e c e i v e r > X M L · i f ( A C T I O N _ U P D A T E . e q u a l s ( i n t e n t . g e t A c t i o n ( ) ) ) { S t r i n g j s o n = i n t e n t . g e t S t r i n g E x t r a ( " J S O N _ D A T A " ) ; / / S e n d t h e J S O N t o s o m e I n t e n t S e r v i c e t h a t w i l l d e s e r i a l i z e / / i t a n d s a v e t h e n e w a p p p r e f e r e n c e s a n d d a t a . } J A V A 19/31
  16. Apps configuration - #3 #imdeveloper Notify i'm Agent when done:

    Non-responding apps and transgressors are killed! Request more time in the U P D A T E _ D O N E intent: · I n t e n t d o n e _ i n t e n t = n e w I n t e n t ( " i t . i m w a t c h . i m c l o u d . U P D A T E _ D O N E " ) ; d o n e _ i n t e n t . p u t E x t r a ( " S E N D E R _ P R O C E S S " , g e t A p p l i c a t i o n C o n t e x t ( ) . g e t P a c k a g e N a m e ( ) ) ; s e n d B r o a d c a s t ( d o n e _ i n t e n t ) ; J A V A · · d o n e I n t e n t . p u t E x t r a ( " D O N E _ E X T E N D " , t r u e ) ; / / S t o r e s t a t u s d a t a i n a B u n d l e t h a t w i l l b e r e t u r n e d / / b a c k t o u s i f a n d w h e n t h e e x t e n s i o n s l o t s t a r t s d o n e I n t e n t . p u t E x t r a ( " E X T E N D _ S T A T U S " , s t a t u s D a t a ) ; J A V A 20/31
  17. Apps configuration - #4 #imdeveloper i'm Agent decides if and

    when an app can have an extra slot The extra slot is not guaranteed! Retrieve previously saved state from the U P D A T E _ E X T E N D intent: · · · i f ( A C T I O N _ E X T E N D . e q u a l s ( i n t e n t . g e t A c t i o n ( ) ) ) { B u n d l e s a v e d S t a t e = i n t e n t . g e t B u n d l e E x t r a ( " E X T E N D _ S T A T U S " ) ; / / S t a r t s o m e o t h e r I n t e n t S e r v i c e t h a t w i l l c o m p l e t e t h e / / u p d a t i n g p r o c e s s i n t h e e x t e n d e d t i m e s l o t ( i f a n y ) } J A V A 21/31
  18. What's not quite how you'd expect All Android 1.6 SDK

    APIs work on the i'm Watch, except: #imdeveloper Sensors APIs require a special library (available on d.imsmart.com) Audio recording APIs (non-technical issues) Web browser is not available Option menus and IMEs are not available Vibration is not available (no vibration motor...) · · · · · 22/31
  19. RTLHelper #imdeveloper Backports some RTL support to Android 1.6 and

    above Similar to Android 4.3's own B i d i F o r m a t t e r Corrects handling of basic UTF Bidi and does shaping for Arabic text · · · One-line usage: · i m p o r t i t . i m w a t c h . r t l h e l p e r . R T L H e l p e r ; [ . . . ] T e x t V i e w t x t _ c o n t e n t = ( T e x t V i e w ) f i n d V i e w B y I d ( R . i d . t x t _ c o n t e n t ) ; S t r i n g o r i g i n a l S t r i n g = " . . . " / / S e t t h e t e x t o f t h e w i d g e t u s i n g t h e c o n v e r t e d S t r i n g t x t _ c o n t e n t . s e t T e x t ( R T L H e l p e r . c o n v e r t ( o r i g i n a l S t r i n g ) ) ; J A V A 24/31
  20. OverlayMenu #imdeveloper Replaces the options menu Open Source Android library

    project (on GitHub!) Auto-hides (if you want); shows "manually" Customize the icons and add o n C l i c k handlers Use the T h e m e . I m W a t c h (or a theme that extends it)! Use a wrapper layout (like for a Navigation Drawer) · · · · · · 25/31
  21. NumPad #imdeveloper A simple IME for numeric values Open Source

    Android library project (on GitHub!) Customizable button images Add o n C l i c k handlers for OK/cancel buttons · · · · 26/31
  22. Sensors library - #1 #imdeveloper Android Sensors API aren't available,

    use our library · Initialize in A c t i v i t y 's o n C r e a t e : · m S e n s o r s = n e w S e n s o r S e r v i c e I n s t a n c e ( U P D A T E _ I N T E R V A L ) ; J A V A Retrieve values from S e n s o r S e r v i c e I n s t a n c e : · a c c X . s e t T e x t ( m S e n s o r s . g e t A c c e l V e c t o r ( ) . X ) ; a c c Y . s e t T e x t ( m S e n s o r s . g e t A c c e l V e c t o r ( ) . Y ) ; a c c Z . s e t T e x t ( m S e n s o r s . g e t A c c e l V e c t o r ( ) . Z ) ; r o t X . s e t T e x t ( m S e n s o r s . g e t R o t a t i o n V e c t o r ( ) . X ) ; r o t Y . s e t T e x t ( m S e n s o r s . g e t R o t a t i o n V e c t o r ( ) . Y ) ; r o t Z . s e t T e x t ( m S e n s o r s . g e t R o t a t i o n V e c t o r ( ) . Z ) ; J A V A 27/31
  23. Sensors library - #2 #imdeveloper Remember to pause/resume detection: ·

    @ O v e r r i d e p u b l i c v o i d o n P a u s e ( ) { s u p e r . o n P a u s e ( ) ; m S e n s o r s . o n P a u s e ( ) ; } @ O v e r r i d e p u b l i c v o i d o n R e s u m e ( ) { s u p e r . o n R e s u m e ( ) ; m S e n s o r s . o n R e s u m e ( ) ; } J A V A 28/31
  24. Bluetooth API #imdeveloper Android 1.6 has no public Bluetooth APIs;

    use ours Only available on i'm Droid 2.2.0+ SPP (Serial Port Profile) Three main classes, similar to Android's API: B t A d a p t e r , B t P r o f i l e C l i e n t and B t P r o f i l e S e r v e r Connect to a specific service (by UUID), or wait for incoming connections (to/from connected phone) Comprehensive guide on GitHub: https://github.com/imspa/imWatch-Bluetooth · · · · · · 29/31
  25. <questions/> Mail us for technical issues and support: [email protected] www

    d.imsmart.com github github.com/imspa g+ +Sebastiano Poggi twitter @seebrock3r
  26. Q&A