Fitness apps make great additions to Android Wear. Lets take a look at one of our favorites, Runtastic. Runtastic is a fitness app that lets you track your walks, runs, bike rides and more. With Runtastic on Android Wear, youll see your time, distance, and calories burned at a glance on your wrist. You can also start, stop and pause your activity by touch. Tuck your phone away in a pocket or backpack and do everything on your watch.
Its challenging to build user experiences that really come alive on Android Wear because its such a new type of device. Runtastic does a great job of showing the right information and providing just the right controls on the screen on your wrist. Lets dig into some of the Android Wear platform features that Runtastic uses to make such a great user experience.
Voice Actions
Android Wear enables developers to launch their activities with voice. Runtastic responds to Ok Google, start running by beginning to track a session and displaying a card with your total time. This means you can start exercising without needing to pull your phone out of a pocket or arm strap. Android Wear is all about bringing you useful information just when you need it and enabling users to quickly and easily take action.
Responding to platform voice intents on Wear is as simple as declaring a standard intent filter to start an activity. For example, to launch your activity for the start running voice action, add the following to your activitys entry in your AndroidManifest.xml:
<intent-filter>
<action android_name="vnd.google.fitness.TRACK"/>
<category android_name="android.intent.category.DEFAULT"/>
<data android_mimeType="vnd.google.fitness.activity/running"/>
</intent-filter>
Custom Cards
Once a user has started a run, Runtastic inserts a card in the stream as an ongoing notification to ensure it is ranked near the top of the stream during the activity. This card uses the setDisplayIntent() function to display custom UI. It provides quick, glanceable information, showing your activity time. Cool!
When the user swipes to the right of the card to expose its actions, we see some quick and easy to understand options; following the Android Wear style guidelines means that Runtastic has a familiar UI and feels like a natural extension of the watch. There are actions for pausing, stopping, and an action to see more details on the run. This action launches a full screen Activity where Runtastic draws a completely custom layout.
Youll notice this data updates live; Runtastic makes use of the Wearable Data Layer API in Google Play Services to synchronize data between the phone and the watch. Its an easy to use API for syncing data between your devices.
Background Services
When a user finishes their run, Runtastic presents them with a special summary card that appears only on the watch. In this case, the notification is generated directly on the watch by a Service. This Service uses the Data Layer to receive information about the completed activity from the phone to the watch, including an image of a map of the users run generated through the Google Maps API.
To show that information, the app uses Android Wears NotificationManager, which functions just like the NotificationManager on a phone or tablet, except that instead of creating notifications in the pull-down shade, they appear in the stream.
Runtastics implementation on Android Wear is a perfect example of how to take advantage of wearables to make something truly useful for users. For more information on these and other great platform features, please see the developer documentation.
For more inspiring Android Wear user experiences, check out this collection on the Play Store!
Posted by Mano Marks, Google Developer Platform Team
0 comments:
Post a Comment