Android Wear was released on March 19, 2014 and has Moto 360 and LG Watch two products. The source is not yet open, but the developer can download its image and the corresponding SDK, so that developers can do the pre-development through the simulator. In fact, Android wear consists of two parts, part of the operating system running on wearable devices, part of the SDK for handheld devices (mobile, tablet) programs, the main purpose of which is to provide a reference and specification for application development on wearable devices, To guide users in developing applications that can collaborate with small screen devices. The use of "collaborative action" here is because the user-developed program will never run on a wearable device, it simply defines the UI interface, and the Android Wear service will pass the UI information to the wearable device, and the wearable device can use its own UI mechanism to display it. From this point of view, the role of Android wear is to provide a set of display standards in handheld devices and wearable devices, which in this format can be displayed across devices. This standard is Android notification, when the wearable device and the handheld device is connected, the handheld device notification will be passed to the wearable device, and then the wearable device will be notified in the way appropriate for their operation, of course, in order to better display on the wearable device, developers need to make a small number of changes, This is the role of the SDK. Android Wear not enough information at the moment, the next few days of the Google IO Conference (6.25-6.27), Android Wear will be a hot topic, will release more information.
Android Wear Launch reason
We know that Android has been guiding users through a program that supports different screen devices since its birth. This is also the Res directory has layout, Layout-land, layout-portrait, layout-sw600 and other directories, that is, to allow different devices to use different layout to achieve device compatibility. So why is Android going to need a separate SDK for wearable devices? This is because devices such as wearables and tablet phones are too different. Specifically reflected in the.
1) The screen is too small, the old display mode is no longer suitable
The wearable device (watch) screen is not small, but particularly small, compared to mobile phones and tablets. So on this screen, the application is basically not show a few view, so the original complex layout file determines the mechanism of the program display framework is too complex, also not used.
2) Input problem
We know that from the PC cut to the phone, we learned to cut from the external keyboard into the soft keyboard, and enjoy it. What about the wearable device? An input keyboard pops up on a small, poor device such as a watch, and the user is expected to enter it with a magnifying glass.
3) Non-independence of equipment
We know that wearable devices are small, natural hardware is not strong and accessories are small (cameras, internet modules, etc.), naturally unable to do more complex operations, so wearable devices often need to help the group through the use of handheld devices to complete tasks, such as taking pictures, surfing the internet.
Android wear key module analysis
Display:
The screen is small, minimizing the elements of the UI interface, displaying only important content, and making it as easy as possible for user interaction. From this perspective, the WINDOW8 system is visionary, and the card-based UI presents a natural fit for any resolution of the display device. In particular, the Metro Desktop program dynamic message display, very suitable for wearable devices. At the beginning, it has been mentioned that the display of wearable devices is mainly realized by displaying notifications, the mechanism itself avoids some of the above shortcomings, to achieve the purpose of showing the focus, because the Android notification itself is relatively simple, but also suitable for small screen operation. In addition to this, there are some other changes. For example, the Android Wear extension and added some notification objects, such as action, pagination display.
Generic Android Device Notification object Notificationcompat.builder Notificationbuilder = new Notificationcompat.builder (mcont EXT). Setcontenttitle ("New mail from" + sender.tostring ()). Setcontenttext (subject). Setsmallicon (R. Drawable.new_mail);//notification with action, the action on the wearable device is displayed on a separate page//, the user slides left to enter the action page, This is the interaction notificationcompat.builder Notificationbuilder = new Notificationcompat.builder (this) we are going to mention below. Setsmal Licon (r.drawable.ic_event). Setcontenttitle (EventTitle). Setcontenttext (eventlocation). setContentInt ENT (viewpendingintent). Addaction (R.drawable.ic_map, getString (R.string.map), mappendingintent);//Below Wearablenotifications is the focus, this is specifically for wearable devices//a class of notification, such notification allows multiple display pages, the user swipe left and right// It's natural to see more content notification notification = new Wearablenotifications.builder (notificationbuilder). Sethinthidei Con (true). Build ();//The following notification send logic is the same as the normal device notification NotificationmanageRcompat Notificationmanager = Notificationmanagercompat.from (this); Notificationmanager.notify (NotificationId, Noti fication);
When this notification is sent out, the wear interface will appear as follows:
Interaction:
Small screen, natural UI can not provide too many choices for users to do, there is no space to enter the way of soft keyboard. Because the interactions on Android Wear tend to be more focused, that is, each interface does only one thing, which simplifies the way you interact. This mode of interaction can be simplified to display notifications, and the user responds to this simple process. At the same time the user reply must also be convenient, minimize the user's manual input, because Android Wear provides two commonly used, offer option list and voice input two kinds. At the same time, Android Wear normalized the mode of this reply. This interaction is called action on Android Wear, and input is just a way of interacting, in Android Wear called Remoteinput, there is remote word because often this input is not sent directly, but will be sent first to the handheld device (mobile phone, Tablet), and then the handheld device is actually sent. The specific code logic is as follows:
Input for pure speech:
Remoteinput remoteinput = new Remoteinput.builder (extra_voice_reply) . SetLabel (Replylabel) . Build ();
Input with default text options and voice:
String Replylabel = Getresources (). getString (R.string.reply_label); string[] replychoices = Getresources (). Getstringarray (r.array.reply_choices); Remoteinput remoteinput = new Remoteinput.builder (extra_voice_reply) . SetLabel (Replylabel) . Setchoices ( replychoices) . Build ();
Add an input response to a notification
Notification replynotification = new Wearablenotifications.builder (Replynotificationbuilder) . Addremoteinputforcontentintent (Remoteinput) . Build ();
Multi-Device connection
Because of the multi-device interconnection, data transmission and so on is the system framework and the underlying problem, rather than directly with the device users dealing with, this will be open in the source code, I will do a separate article to analyze. You may ask, why not open, in fact, Google is now making up a mistake, that is, because Android is too open to cause Android fragmentation, Google has no control over Android, domestic manufacturers that is even more. Thus, on Android for wearable devices, Google estimates that it would like to unify the interface to enhance the consistency of the user experience.
Android Wear Experience Environment setup:
1. Download the SDK
1) Upgrade Android-sdk-tool to version 22.6 or higher
2) Start the SDK Manager and select the following check box:
Then select the check box below and download (Focus on androidwear ARM EABI v7a System image and Android support Library two items)
[Email protected]:~/android-sdk-linux/tools$./android
2. Create/launch Android Wear simulator
This should be very simple, just select Androidwearround/square in the simulator interface.
When you're done, click Start
3. Android Wear Preivew program installed on mobile device
The program is actually a launcher, the default launcher on wearable devices is this. The program also has a background service, which is responsible for receiving notification of the system and then displaying it on the launcher. For wearable devices, the service is able to receive notifications from a remote (mobile phone) and then appear on the launcher. After the installation, press the home key to pop up the selection box and select Android Wear on your phone to enter Android Wear launcher. You then need to turn on the Allow receive notifications option. Because the app is in preview, Google doesn't want to open the app because I didn't upload the app, and I'm interested in registering as a tester on the page below to experience
Http://developer.android.com/wear/preview/signup.html
Hello Developer,
Thank signing up for the Android Wear Developer Preview.
To Begi N Developing on Android Wear, you'll need the preview support library and the Android Wear Preview app for your mobile Device. Follow these steps:
Download The Preview support library and samples.
opt-in to become a tester o f the Android Wear Preview app in the Google Play Store. After opt-in, it could take up to $ hours for the Android Wear P review app to being accessible to your in Google Play. Make sure the Opt-in user account was the same user signed in to Google Play.
Refer to the Android Wear developeRGet StartedPAGe for details. Since This was a preview release, please don't publicly distribute apps built with the preview library.Also Note that the APIs is potentially subject to change and you'll need to modify your apps when they is released Out of preview. |
After the message, there will be a display similar to the following:
4. Connect the phone and the simulator
Just mentioned, the simulator is by reading the notification on the phone to show that the natural need to have a communication channel, for the simulator, is through the ADB TCP channel. This is accomplished by the following command:
For the actual use of the scene, smart watches and other wearable devices are generally via Bluetooth or wifi-direct to communicate with the mobile phone.
Adb-d forward tcp:5601 tcp:5601
Summary:
Overall, Android Wear has achieved two main points:
1) Establish cross-device display interaction standards. Notifications are transmitted from the handheld device to the wearable device according to a certain standard, the wearable device based on the notification information, and then displayed, the user's response is then returned to the handheld device.
2) modified the androidnotification display mechanism to make notification a device display standard and allow notifications to be displayed in a way that is suitable for wearable device display interactions.
/********************************
* This article from the blog "Love Kick Door"
* Reprint Please indicate the source: Http://blog.csdn.net/itleaks
******************************************/