Skip to content

Instantly share code, notes, and snippets.

@patrickhammond
Last active April 30, 2018 21:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save patrickhammond/f80be774ca003592e1e8 to your computer and use it in GitHub Desktop.
Save patrickhammond/f80be774ca003592e1e8 to your computer and use it in GitHub Desktop.
Getting Started with Android Wear Outline

Getting Started with Android Wear

Disclaimer

Details presented tonight are likely to change after Google I/O.

What is Android Wear and why should I care

  • New API to support wearable devices (currently only watches) coming to market soon.
  • Lots of wearable attention at Google I/O
  • Incredibly easy to make your apps work well on Android Wear devices

Current devices

Getting Setup

  • Have a physical Android device running 4.3 or later
  • Sign up at developer.android.com/wear
    • Within 24 hours (usually within 1-2 hours) you will receive a confirmation e-mail (http://cl.ly/image/3B0J1K0k1q0H) with two important things
      • Link to download samples, preview, libraries, etc.
      • Link to be a beta tester for the Wear Preview app
  • Install required packages through the Android SDK Manager (http://cl.ly/image/2X0S2y223b32, http://cl.ly/image/2D443W443N2U)
    • The Android Wear SDK through the Android SDK Manager
    • The latest version of these packages installed in the Android SDK Manager
      • Android SDK Tools
      • Android Support Library
      • Android Support Repository
  • Setup an Android Wear emulator (http://cl.ly/image/3I1k0Q3b2z09)
    • Under the Device drop down pick "Android Wear Round" or "Android Wear Square"
    • Under the Target drop down pick "Android 4.4.2 - API Level 19"
    • CPU/ABI drop down should default to "Android Wear ARM (armeabi-v7a) (Sorry...no HAXM support at this time)
    • Under the Skin option pick "Android Wear Round" or "Android Wear Square" (should match what you picked for a device"
    • Turn on the Snapshot checkbox
    • Save and launch the emulator
  • Pair the emulator to your device
    • Ensure USB debugging on your device is turned on
    • Ensure that the the only emulator running is the Wear emulator and the only device plugged in is the device you will use for pairing
    • Open the "Android Wear Preview" app
      • If this is your first time, tap the blue box at the top to open up "Notifications Access".
      • Check the "Android Wear Preview" checkbox, confirm the prompt, hit back.
    • Do some ADB port forwarding magic from the command line using:
      • adb -d forward tcp:5601 tcp:5601
      • (FWIW, adb -d forward <local> <remote> translates to forward all local device ADB traffic (emulator) to the USB connected (-d) remote device).
    • Return to the preview app and your device should now be connected to the Wear emulator (which is now much more interesting!)

Capabilities and limitations

  • Current Wear SDK capabilities are still evolving. Keep up with the latest and greatest at developer.android.com/wear/index.html
  • You should also NOT ship applications based on the Developer Preview SDK because your app will break when the official SDK is released.

What you can do today

  • Extend your app's notifications to Android Wear
    • Add extra pages specific to Wear
    • Add voice reply actions (emulator still requires you to type input...)
    • Stackable notifications
    • This is not a limited set of current features: think about what notifications you can trigger today (geofences, activity detection, etc) and imagine those on Wear.

What is coming soon (next week?)

  • Custom UI
  • Sending data back to the paired device
  • Sensors
  • Voice actions

Demo some stuff

  • See: http://developer.android.com/wear/notifications/creating.html
  • First: Make sure we have all the right imports: import android.preview.support.wearable.notifications.*; import android.preview.support.v4.app.NotificationManagerCompat; import android.support.v4.app.NotificationCompat;
  • Also make sure we do not have references to the non-compat version of the Notification classes.
  • Extend an app's current notification with notification pages
  • Extend an app's current notification with stackable notifications

Useful Sites

Presentation Notes
  • Device mirroring: java -jar asm.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment