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

Wearable Droids for Human Beings

Wearable Droids for Human Beings

This talk is the one I gave during the Google I/O Extended 2016 in Turin

Roberto Orgiu

May 18, 2016
Tweet

More Decks by Roberto Orgiu

Other Decks in Technology

Transcript

  1. WHAT CAN WE DO ON ANDROID WEAR? Adding Wearable features

    to notifications Creating Wearable apps Creating Custom UIs Sending and syncing data Creating Watch faces Detecting location Requesting permissions Using the speaker
  2. WORKING WITH NOTIFICATIONS Big Views BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();

    bigStyle.bigText(eventDescription); new NotificationCompat.Builder(this) NotificationCompat.Builder notificationBuilder = .setStyle(bigStyle);
  3. WORKING WITH NOTIFICATIONS Wear specific actions BigTextStyle bigStyle = new

    NotificationCompat.BigTextStyle(); bigStyle.bigText(eventDescription); new NotificationCompat.Builder(this) NotificationCompat.Builder notificationBuilder = .setStyle(bigStyle); .extend(new WearableExtender().addAction(action)) // Big Views
  4. WORKING WITH NOTIFICATIONS BigTextStyle bigStyle = new NotificationCompat.BigTextStyle(); bigStyle.bigText(eventDescription); new

    NotificationCompat.Builder(this) NotificationCompat.Builder notificationBuilder = .setStyle(bigStyle); .extend(new WearableExtender() .addAction(action)) // Big Views // Wear specific actions
  5. CUSTOM STUFF Custom layouts • BoxInsetLayout • CardFragment • CircledImageView

    • ConfirmationActivity • CrossfadeActivity • DelayedConfirmationView • DismissOverlayView • GridViewPager • GridPagerAdapter • FragmentGridPagerAdapter • DotSpaceIndicator • WatchViewStub • WearableListView http://goo.gl/JYGOkO
  6. • Extend WearableActivity • Call setAmbientEnabled() • Override onEnterAmbient(Bundle ambientDetails)

    • Override onExitAmbient() • Don’t forget onUpdateAmbient() CUSTOM STUFF Keeping your app visible http://goo.gl/D7oixw
  7. SYNC ALL THE DATA! Access the data layer Choose the

    right way to communicate Implement the callbacks
  8. SYNC ALL THE DATA! Declare Google API Client on both

    the phone and the wearable project Invoke connect() method Start using the client in the onConnected() callback Access the data layer
  9. SYNC ALL THE DATA! Declare Google API Client on both

    the phone and the wearable project Invoke connect() method Start using the client in the onConnected() callback Access the data layer
  10. SYNC ALL THE DATA! Access the data layer Choose the

    right way to communicate Implement the callbacks
  11. SYNC ALL THE DATA! DataItem - automatic sync MessageApi -

    remote procedure calls Asset - blobs of data WearableListenerService - background services DataListener and MessageListener - foreground components ChannelApi - Assets sync’ed with DataItems, good for large files Choose the right way to communicate http://goo.gl/x8t3YG
  12. SYNC ALL THE DATA! Choose the right way to communicate

    http://goo.gl/x8t3YG DataItem - automatic sync MessageApi - remote procedure calls Asset - blobs of data WearableListenerService - background services DataListener and MessageListener - foreground components ChannelApi - Assets sync’ed with DataItems, good for large files
  13. SYNC ALL THE DATA! Access the data layer Choose the

    right way to communicate Implement the callbacks
  14. http://goo.gl/B5rCMZ SYNC ALL THE DATA! Implement the callbacks Find connected

    nodes with NodeApi.getConnectedNodes() Implement MessageListener Set the listener with MessageApi.addListener() Send message with MessageApi.sendMessage()
  15. SYNC ALL THE DATA! Access the data layer Choose the

    right way to communicate Implement the callbacks
  16. http://goo.gl/UTs63q USING THE SPEAKER Detect the speaker Retrieve the AudioManager

    from Context’s system services (Context.AUDIO_SERVICE) Check if the the PackageManager.FEATURE_AUDIO_OUTPUT is available within the system Retrieves the output audio devices with audioManager.getDevices(AudioManager.GET_DEVICES_OUT PUTS) Check if any of the devices is the speaker (AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)