📜 ⬆️ ⬇️

Development and debugging of applications for Android Wear

Wearable devices are the cutting edge of today's information technology. This is a powerful trend. The most popular "wearable computers" are running the Android Wear OS from Google. It is not so different from Android, which is familiar to a huge number of developers. As a result, any of these developers can easily start creating applications for Android Wear and claim their share of attention from the very promising market of wearable applications.



In this article we will talk about the OS Android Wear , paying particular attention to the devices running under its control, the types of applications, their development and debugging. In particular, consider two ways to debug using ADB.

Devices


The concept of "wearable computer" is suitable for a wide range of "computers". Among them - headsets for phones, medical and sports devices, "digital jewelry" and even computers for animals. However, today the so-called “smart watches” are most prevalent.
')
The largest equipment manufacturers produce their own series of watches, which are carried on board Android Wear. Among the devices of this type can be noted ASUS ZenWatch 2, Motorola 360, LG Watch Urbane, Samsung Gear S, Sony SmartWatch 3. These watches look different, but their functionality, due to the same software platform, has much in common. This application is Google Now, the ability to track the user's physical activity, tools to control the playback of music, support for voice commands.

All smartwatches have one more common feature: they depend on smartphones, interacting with them using Bluetooth. This approach is used not only in the Android environment, but also on the iOS platform. Interaction of smartphones and tablets with watches at the program level is provided thanks to special accompanying applications.

What to develop for smart watches?


Although Android Wear is a relatively new project, the Android Wear Center , a platform similar to Google Play, offers many applications designed specifically for wearable devices.


Application store for smart watches

There are programs for every taste. Every day, the Android Wear Center publishes new applications for personalizing watches, for working with music, applications for organizing work with communication functions, development for health, sports, and others. Despite the small size of the watch screens, there are games for them. For example - arcades and puzzles, although there are not so many "wearable games" yet.


Games for smart watches

The vast majority of applications are dials that allow you to customize the main “hourly” function - the time display.


Dial applications

How to develop?


On the one hand, writing applications for smart watches is very similar to creating programs for tablets and smartphones. Familiar Android developers with tools such as the JDK, Android SDK (Android Wear platform supports most of the Android API), Eclipse, Android Studio, or other integrated development environments. Here you can find a list of classes from the Wearable Support Library.

On the other hand, Google has published a creative concept and design principles created specifically for those who are developing "wearable" applications. These documents reveal the main differences between "mobile" and "wearable" technologies. When developing applications, one should take into account the small screen size of a smart watch and the special nature of user interaction with the device. In addition to this, it is necessary to take into account the structure of the application , the dependence of the behavior of programs on the context , features of the user interface , style and the ability to create dials .

How to debug?


Debugging is something that the process of creating any program code does not do without. Development for Android Wear is no exception. In this section, we will discuss the debugging of “wearable” applications on the example of LG G Watch R watches connected to Nexus 4.

Android Wear supports two debugging methods: using a wired USB interface and wirelessly via Bluetooth .

Regardless of which method of communication between the smart watches and the PC is chosen, the following preparatory steps need to be performed.


After that, if you plan to use USB debugging, the following actions are performed.


After performing the above steps, the state of the devices will change, this can be seen in the figure.


Change device connection information

When the connection succeeds, the list of devices recognized by the ADB will look something like the one shown below.


List of devices recognized by ADB

Now that all the preparatory steps have been completed, the applications on the clock can be debugged using ADB commands.

How to take screenshots on the clock?


ADB can not only debug applications. The possibilities of this tool are much wider. For example, making a screenshot on the clock is not as easy as it might seem at first glance. So, the team for taking screenshots in the program that provides communication with the clock, makes copies of the screen, but can only send them by e-mail or publish on social networks. In order to get a copy of the clock screen on a computer, it is more convenient and quicker to use the appropriate ADB commands:

 adb shell screencap -p /sdcard/screenshot.png adb pull /sdcard/screenshot.png 

Please note that the screen of the clock is round, and the screenshot is square. This should be considered when developing applications and working on their usability. If the application interface element is visible on a copy of the screen, it will not necessarily appear entirely on the clock screen.


Square screenshots of watches with a round dial

findings


The alliance of modern technologies, such as the Intel Quark processor and the Android Wear operating system, opens up new opportunities not only for device developers, but also for application developers.

As you can see, an Android developer with experience in creating applications for smartphones and tablets can easily switch to programs for wearable computing devices, such as smart watches. It is only necessary to take into account some of the features and can be taken to work.

Source: https://habr.com/ru/post/270829/


All Articles