Monday, August 29, 2016

Android Wear – emulator in Visual Studio and the first application in … – dobreprogramy

Tests Motorola Moto 360 2 shares of Lenovo have shown great potential in applications on Android Wear. Incidentally, for some time now I bury in Xamarinie, which is a platform aimed at developers .NET (C #) to create multiplatform applications (not just mobile). With curiosity, I decided to find out how to write software for Android Wear from the .NET developer. First, we will need …

emulator

Work on the preparation of the entry and applications started yet physically watch (more about the tested Moto 360 2), but, unfortunately, the time flew by and we had to give SmartWatch. Fortunately, with the help of emulators come.

Microsoft has released a great addition Visual Studio Emulator for Android, that runs any version of Android on Windows. In addition, the whole is based on Hyper-V, allowing the emulator to act very quickly, several classes better than what we get in the SDK from Google on the windows. Sorry …

Visual Studio Emulator for Android not lived to see even use Android Wear, which you need at a given time to use the emulator provided with the Android SDK. The worst part is that Windows is a large number of problems with its operation.



Download Files

I assume that you already have installed Xamarin in Visual Studio.

In this case, go to the Android SDK Manager (Visual Studio Tools menu – android). Here, click on Tools-Tools Android SDK and Android SDK Platform-tools. In addition, the selected version of Android (at least 4.4, it is best to use the latest, in my case is 7.0, although it should also have version 6.0, which will compile our project in VS) select the needed packages, mindful of Android Wear.



Configuring the emulator

, therefore, came time to configure the emulator Android Wear in Visual Studio. Once in the IDE, select from the menu Tools – Android – Android Emulator Manager. After running Android Virtual Device (AVD) Manager, go to the tab Device Definitions.

Select any device with Android Wear. Due to the fact that I got used already to the round screen Moto 360 I note: Android Wear Round. Now create a new “virtual machine” on the basis of the definition you flag the device by clicking on the button “Create AVD …”

In the new window, check to see if we have the required version of Android and the device (in this case Android 7.0 and Android Wear ). We also need to choose the right skin emulator, and processor version of the Android Wear, the last moment. It is worth noting also “Use GPU Host”, in my case, the lack of this option resulted in incorrect display screen device emulator.



CPU: ARM vs Intel Atom – Windows 10 Anniversary Update suxx

Emulate can be two types of processors. This basic ARM which probably will not be any problems (except that it is free).

The most interesting option, however, is an emulator based on the Intel Atom, therefore, that supports hardware virtualization and runs up to 10x faster than ARM emulator. It is with him, however, a few problems. If we have a system activated Hyper-V, we have to deactivate them (and reboot), the fastest of the command line:


 bcdedit / set off hypervisorlaunchtype
 

In addition, we have HAXM (Intel® Hardware Accelerated Execution Manager). Virtualization engine charge here: Intel® HAXM. Wszsytko it would be beautiful if it were not that the version HAXM in the current version (6.0.3) does not like the Windows 10 Anniversary Update! At a given moment, people with the latest update to Windows 10, are not able to take advantage of HAXM, and thus run the emulator based on the Intel Atom. Unfortunately, in this case, is the only choice slower emulator ARM.



Launch emulator

If everything went correctly, then on the first tab of the Android Virtual Device (AVD) Manager, we have created an emulator Android Wear:

Just just click on the "start" and "launch" to run our brand new emulator for Android Wear:

at this point, we can play with the system. Here a small note, at this point we chose emulator with the latest version of the system, that is ... Android Wear 2.0!



Xamarin Android Wear in Visual Studio

It's time to launch our first application on the emulator Android Wear . Click on File - New- Project and from the window we choose Wear App (Android). We also as part of testing and learning download one of the available projects at Xamarin.

The project Chose the correct version of Android, which will compile our project:

On the top bar, select created emulator:

and fire up our project

The first start-up may take a while. IDE throw on Android Wear addition to our application the necessary packages: Mono Runtime Shared and Xamarin.Android API Support for development works. After a few moments, our eyes will punish the first application developed for Android Wear:

Summary

Android Wear is quite fresh platform, the more the framework for Xamarin is extremely new branch on this platform. It is worth noting that applications on Android Wear can be written in C # only pure Xamarinie, we will not use here Xamarin.Forms. Setting emulator can cause some problems, but I think it's worth it. Volunteers should try their hand with applications on Android Wear now. Watch apps use many of the same controls as normal Android app. In most cases, the trap on Android Wear work will be with the "major" on the smartphone. For exchanges of data between them is Data API and Message API, but that's a topic for another post ...

LikeTweet

No comments:

Post a Comment