This post will give a brief overview of Android Wear, and then about the platform for developers.
Android Wear aims to give users the right amount of information at the right time. In line with this theme, Google has released design principles to help developers focus their thinking about Android
Wear apps. We'll take a brief look at this, as well as examine what's necessary for app development in the Android
Wear environment, and how the available APIs can be used to help Android developers work on apps for the Android Wear platform.
The Android Wear platform
Android
Wear, the open operating system for wearables, has a new user interface - a result of Google's understanding of how we use our phones and how we engage more with our environment. For example, data shows that
We use our phones to check our messages on average about 150 times a day. Every time we do this, we risk getting lost inside other apps, often consuming a lot of unnecessary time in a task program, and sometimes even
totally forgetting the most important information we're looking for.
The first devices to set Android Wear on fire were the Samsung Gear Live and the LG G Watch, both of which were unveiled at the Google
I/O conference in June. Watches are the first choice target for Android
Wear, and it's true: most people use watches every day. These so-called smartwatches usually need to be paired with an Android phone, and by working seamlessly with the latest Android phones, Google is allowing users
to see the utility of the Android Wear platform.
In fact, here's what you need to do to get started with Android Wear:
1. an Android 4.3 device;
2. an Android Wear app from the Google Apps Marketplace;
3. a paired Android phone device with an Android Wear device.
Yes, that's right. With that done, most of the information on your phone can be viewed on a wearable device. Not only can you view this information on your watch, but you can also interact with it, delete it, and more. What this shows is that it doesn't take any effort or very little time to get Android apps and paired devices running - Android phone users can do this.
It's important to note that phones and wearables connect via Bluetooth. Wearables can't currently access the network independently, so they need to be connected through the phone.
While Android Wear is flexible, it's currently most focused on the watch category.
In early September, Motorola unveiled its much-anticipated smartwatch, the Moto 360. it's powered by Android Wear. The Moto
360 received great praise thanks to its beautiful design, and its $250 price tag has been well-received by consumers. Other developers, including Asus, have already announced plans related to releasing Android Wear smartwatches too.
Usage modes
The two main ways to interact with an Android Wear device are "suggestions" and "requests.
"Suggestions," as the name suggests, are timely and useful information pushed to Android Wear devices in the form of notifications. The user interface sets this up as a card, as shown below.
It's worth noting that the Wear app recognizes context, so it only pushes in-text information. These types of notifications are timely, brief, and have minimal interaction with the user.
As for the "on-demand" mode of use, the user signals the wearable via voice and it responds with a message. The device contains a microphone that allows the user to invoke a standard set of actions by saying "OK,
Google" or tapping on the home screen. The user interface prompts the user to say what action they want to perform. Standard actions include "take notes," "make a phone call," and
"send a message. You can register the standard commands with the application, or you can customize the prompt text.
Design philosophy
Now that we understand the basic usage patterns of Android Wear, it's time to look at the user interface and design guidelines.
As you can see below, much of the information presented to the user is in the form of cards.
Note the different parts of the card. Currently Android Wear app notifications will appear in the standard format above. But we're talking about a minimal amount of information that's easy to read and contextually relevant, and you'll need to spend some time thinking about when to add text notifications and what text to display.
Notifications can be displayed in single or multiple cards. If multiple cards are used, the user will need to swipe the page from left to right to view them.
With an overlay, you can even view multiple notifications in a single card, as shown below.
There are four key points to keep in mind when designing the Android Wear user experience, which every Google Wear Design visual creative part of an Android Wear app should do:
1. Auto-launching: Users shouldn't need to install apps on their Wear device separately; the Wear device is not a The Android Wear app should be able to recognize time, place and activity and push relevant cards accordingly.
2. Ease of readability: Because users wear the device on their wrist, reading notifications should be as easy as checking the time on a traditional watch. Remember to pay special attention to the title: the shorter the better - you can see the main points at a glance.
3. Effective use of Suggest and Demand modes: The Android Wear developer page says: "Android
Wear is like a great personal assistant. personal assistant. It only stops when you don't need it at all, and it's always there to provide you with answers. "To provide this experience, developers should consider when and how to use the "suggestion" and "requirement" modes.
4. Zero-low interaction with the user: Developing apps and programs is a matter of remembering that wearables are particularly small. Apps must be easy for the user to interact with, that is to say, using sounds or simple swipe or tap gestures.
The Android Wear design team has done a lot of work documenting how to effectively integrate design concepts when expanding on existing Android Wear apps. (Check out the Android Wear design section.)
Development details
In this section, we'll help you get a primer on the key concepts of Android Wear development.
You can choose either Eclipse or Android Studio as the integrated development environment (IDE) for Android Wear. Google recommends developing with Android Studio. Download API 20 (4.4 KitKat Wear) via Android's SDK Manager:
Android Studio provides a convenient way to add Android Wear support to an existing application or to create a new project: Android Studio uses a component model in which the phone and Android Wear are part of a single project.
To create a new project in Android Studio, click File- > New Project. On the second page of the wizard, select Component Factor and make sure you select the Android Wear module as the component factor for your development (see below).
Once you have completed selecting all the options, the project will be automatically generated. You'll see that this Android project has two modules: Mobile and Wear. mobile's the apps that are used on your phone, and Wear is the program that runs on Android Wear.
The Wear app is not available as a separate package in the Google Play Store. You need to put the mobile and Wear apps in the same app APK. When a user downloads the APK on their phone, the Wear app is automatically transferred to the paired Wear device.
The default project generated by Android Studio is nothing special. During testing, we need to write our own code, depending on what we want the app's Wear to perform.
Notifications
Android Wear development can be analyzed from two perspectives: notifications and the Android Wear application itself (included in the APK folder).
For users who have already installed official Android Wear to their phone from the Google Play Store, as well as those who have already paired their phone with a Wear device, there is no need to make any changes to notifications in the app.
With that said, sometimes changes are necessary to make Wear truly useful.
You can make notifications appear only on the phone or the wearable or both. Also, as mentioned above, developers should think about how to take advantage of the user interface (UI) -- i.e., background images, notification headers, text, and so on.
To create handheld notifications that will be sent to a wearable device, Google recommends using Notification Compatibility Builder.Android's support library offers a range of categories that you'll need to add to your project.
If you are using Android Studio, you need to add the following build times for build.gradle files that are part of the mobile module.
compile "com.android.support:support-v4:20.0.+"
To create a notification, you can try the following code in your mobile app:
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setContentTitle("New API")
.setContentText( "XYZ API got added to Food Category")
.setSmallIcon(R.drawable.ic_mynotification)
.setContentIntent( PhoneActivityPendingIntent);
You can then trigger the notification based on your logic as follows:
NotificationManagerCompatnotificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(notificationId, notificationBuilder.build());
Now, when the user on the Wear device receives a notification, they tap the notification on their phone or swipe to the left to initiate wait mode and then display the start action.
As an extension, if you want the notification to appear only on the phone, you can create it by specifying setLocalOnly.
In the example above, we're only showing one card, but you can look at notification cards with multiple pages or even collapsed.
Wearable apps
While Android Wear supports notifications from your phone, sometimes it's not enough. There are several scenarios, including:
wanting to start an activity on a Wear device when you receive data on your phone;
sending a message from a Wear device to your phone that in turn performs some activity or does something in the background;
creating a custom interface on a Wear device;
writing a program and can initiate different action commands by receiving voice input.
All of the above mentioned are possible, provided you know some basics of the Wear API.
Connectivity and data exchange
The *** same theme in the cases provided earlier is that both the phone and the Wear device need a mechanism that allows for continuity between the two parties, and then once the connection is established, there is a need to exchange information with each other. This in turn can trigger the correct commands on the respective devices.
The connection between the phone and the Wear device is served by Google. The Google API client provides an example of this connection.
mGoogleApiClient = new GoogleApiClient.Builder(context)
.addApi(Wearable.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
You can build or close the connection at the appropriate campaign cycle as follows:
@Override protected void onStart() {super. onStart();
mGoogleApiClient.connect(); } @Override protected void onStop() { super.onStop(); mGoogleApiClient.disconnect(); }
Once the connection is established, you can view examples of different APIs that facilitate sending and synchronizing data between devices:
Node API: This API is used for two devices connected or separated to enable keeping track of them through the NodeListener interface method.
Message API: This API is used for both parties to send messages to each other. This requires the receiver (MessageListener) to have a listener that can receive the message.
Data API: This API is used to synchronize data between devices. The platform is responsible for providing a synchronization mechanism for both parties. You need to complete the DataListener interface before you can receive messages. It is recommended to create an instance on the Wearable Device Listener service platform first and then listen to some events you are interested in.
The data layer interfaces are shown below, choose the one that suits you.
tatic interface DataListener {void onDataChanged(DataEventBufferdataEvents);}
static interface MessageListener {void onMessageReceived(MessageEventmessageEvent);}
static interface NodeListener {void onPeerConnected(Node node); void onPeerDisconnected(Node node);}
The rest of the functionality - i.e., the instructions that need to be taken for a particular message - depends entirely on the functional needs of the application.