Network simulation and more in the VS Emulator for Android

By now, hopefully you’ve heard about the new Visual Studio Emulator for Android, which is available as a standalone download for Eclipse and Android Studio users. Today, we’re issuing an update that addresses some of your top requests, including network simulation and improved screenshot functionality. Let’s take a look at what you can expect from the September update.

Network simulation

Apart from touch input, probably the most used feature of a device is network connectivity. Whether pulling down a list of high scores, streaming video, or uploading a photo to the backend, apps make heavy use of the network and need to be tested for robustness against a wide range of network conditions. What happens when signal strength is weak and a significant number of packets are dropped? How does your app control data consumption when connected to a 3G network where data may be metered versus a Wi-Fi network where data is probably not capped? These questions and more can be answered using our new network simulation feature in the emulator. Just open the emulator and navigate to the “Network” tab in the Additional Tools window.

By default, the emulator is set to appear connected to a Wi-Fi network, which uses the full speed and signal of the host computer. If you switch to Cellular, the Network type and Signal strength dropdowns will become active and you will see details of the network being simulated below them.

Changing the network type will do two things. First, it will throttle the download and upload bandwidth to match that of a typical network of that type. Second, it will change the network visible to Android to be the network type you selected. No network will appear available to Android when “No network” is selected. This ensures that Android’s networking APIs (e.g. correctly return the network type being simulated. Note that this is something most other emulators forego—they simply simulate the bandwidth of that network type and remain actually connected to Wi-Fi.

Changing the signal strength will do three things. First, it will increase or decrease the percentage of upload and download packets dropped to match the signal strength specified (lower signal strength means higher packet loss). Second, it will modify the signal strength of the network that appears to Android, ensuring that Android APIs return correct values for signal strength (e.g. android.telephony.SignalStrength.getLevel()). Finally, it will modify the bandwidth to match how bandwidth would be impacted by a weaker signal.

Improved screenshot functionality

Another piece of feedback we’ve received is that the Screenshot tab sometimes captured a corrupted or mangled image. We’ve fixed this and enabled the ability to use adb shell screencap to grab an image as well.

Wrap up

This update will appear as a notification in your Emulator Manager and in Visual Studio’s Notification Hub if Visual Studio is installed. If you haven’t tried out the emulator, you can download it directly or visit our website for more information. Thanks for the continued feedback—keep it coming by commenting below, using the Send-a-Smile tool in Visual Studio or in the Emulator Manager, or asking for help on StackOverflow using the android-emulator and visual-studio tags (but first, check our troubleshooting document for common problems)!