Geeks With Blogs

News

Microsoft MVP


DZone MVB


Moderator at CodeASP.NET


Quiz Master







free counters
Free counters
Added on January 19,2012


Follow Me @vmsdurano

A bit About Me



Disclaimer
The opinions expressed herein are my own personal opinions and does not represent the opinions of my employers. Nor does it represent the opinion of my dog, because I don’t have one.


Vinz' Blog (ProudMonkey) "Code, Beer and Music ~ my way of being a programmer"

In my previous post we talked about how to create app in Wearable and Handheld devices and created a simple implementation of sending/syncing data. In this post I'm going to demonstrate how to deploy and test apps in real device. First of all I am using Nexus 9 and LG G Watch as my test devices.

Before we start make sure that USB Driver for Android is installed in your machine. You can verify it by right clicking on the COMPUTER > MANAGE > DEVICE MANAGER > OTHER DEVICES. If the driver isn't in the list then you must download the driver here: http://developer.android.com/sdk/win-usb.html and refer this link for the installation guide: http://developer.android.com/tools/extras/oem-usb.html#InstallingDriver

The next important thing is to enable USB Debugging in your Handheld device. You can enable it under SETTINGS > DEVELOPER OPTIONS > USB DEBUGGING. Once you have the required driver installed and enabled debugging for your device then just plug-in your Handheld device to your PC or laptop. In Visual Studio you should be able to see the connected handheld device as shown in the image below:

img8

Deploying the App to Handheld device

Following are the steps for deploying the app:

  1. Right click on the main app project and select PROPERTIES > ANDROID OPTIONS.Under Packaging tab uncheck the "Use Fast Deployment (debug mode only)
  2. Under Packaging tab uncheck the "Use Fast Deployment (debug mode only)”
  3. Unload the project
  4. Edit the .CSPROJ file and add this PropertyGroup
<PropertyGroup>
    <JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
</PropertyGroup>

5.   Save and then load the project.  
6.   Right click on the main app project and set it as the startup project  
7.   Build the app  
8.   And then click run or the play button. This will package and install the app to the device. Just wait for it finish.

Deploying the Wear App

You can follow the same procedure for deploying the wear app just like what we did for the main app. If you want to deploy and debug your app over Bluetooth then here are the extra steps:

  1. Open the Android Wear companion app in your handheld device
  2. Tap the menu on the top right and select SETTINGS
  3. Enable "Debugging Over Bluetooth. You should be able to see the status like this:
  4. Host: disconnected
    Target: connected
  5. Connect the handheld to your PC or laptop over USB.
  6. In Visual Studio, go to TOOLS > ANDROID > ANDROID ADB COMMAND PROMPT and run the following commands:
  7. adb forward tcp:4444 localabstract:/adb-hub
    adb connect localhost:4444
  8. After that you should be able to see the wear device in device list as shown in the image below:
  9. img9
  10. Repeat the same steps 1-5 mentioned in Deploying App to Handheld device
  11. Now set your Wear App as the startup project, build the app and run.

Once installed you should be able to set a break point in Visual Studio to do debugging and test your application. Here’s the output of the sample application:

 

That’s it! I hope someone find this post useful! Smile

Posted on Thursday, April 23, 2015 10:48 PM C# , .NET , Xamarin , Visual Studio | Back to top


Comments on this post: Xamarin.Android - Testing, Debugging and Deploying Apps to Wear and Handheld devices

comments powered by Disqus

Copyright © Vincent Maverick Durano | Powered by: GeeksWithBlogs.net