Capturing Traffic from Genymotion Emulator

Capturing IP traffic from a Genymotion Android VM under windows is not trivial. The Genymotion virtual network adaptor communicates independently of the IP Stack of the host OS. Additionally network analyser packages running under windows such as Wireshark rely on WinPCAP library which attaches to the windows IP stack. (Also Loopback traffic doesn’t exercise the IP stack hence is not detected by packages such as Wireshark.)

The way to capture traffic is to configure an interception proxy on the Genymotion VM. This example will use fiddler as the proxy.

Configuring a Proxy on Genymotion

Select WIREDSSID from the Settings Menu

Click on WiredSSID and hold down for 2 seconds to get Modify Network Window

Select Modify Network then manually configure proxy. The IP address will be the IP address of the host machine

Port 8888 is the default proxy port for Fiddler and most other proxy software

Save this. Now all http traffic will be forced to the proxy where it can be intercepted.

Also by proxying to a physical address traffic is forced through the Hosts TCP/IP stack allowing packages such as Wireshark to capture traffic also.

Fiddler is a Http capture tool from Telerik and can be found at http://www.telerik.com/fiddler

To view the traffic in fiddler ensure that the “Allow remote computers to connect” option under Connections is selected

Now you will be able to see Requests from the Dalvik (Android VM) in fiddler. Enjoy debugging your awesome apps.

 

 

Interfacing physical OTG devices to Genymotion Android VM

Using a virtual Android device does NOT mean you can’t interface real devices to it.

In this example I will show how to configure a Genymotion Android VM to interface to an ANT+ usb dongle and receive Heart rate information from an ANT+ enabled heart rate monitor

The key to interfacing USB devices to a Genymotion Android VM is to be familiar with the USB device filters of the Oracle Virtual Box Product which is the host for the Genymotion VM

Open Virtual Box, Highlight the target VM and Select Settings

Select USB

Select USB and make sure USB Controller is enabled. You will see a list of detected devices in the Device Filter Dialog, Select the Device you wish the virtual machine to have access to.

The usb filter works by matching various parameters such as vendor ID, Product ID and Serial number.

This can be seen by editing the Filter as follows

The filter will list the parameters that need to be matched to connect the device. The trick is to use as few parameters as possible as the filter can be buggy!

 

Once the filter is enabled, fire up the Genymotion machine, THEN plug in the device

I use the “USB device info” App installed on the VM to check the status of the USB device

AS you can see the device is seen by the Genymotion VM and can be used with the appropriate App

Have fun using your emulator as USB enabled device.