StackTips
 6 minutes

What is Android Virtual Device

By Nilanchala @nilan, On Jan 19, 2024 Android 3.46K Views

An Android Virtual Device (AVD) is an emulator configuration that allows developers to test the application by simulating the real device capabilities. We can configure the AVD by specifying the hardware and software options. AVD manager enables an easy way of creating and managing the AVD with its graphical interface. We can create as many AVDs as we need, based on the types of device we want to test for. Below are the steps to create an AVD from AVD manager graphical interface

  1. Go to Window ->AVD Manager and select Virtual Devices.
  2. Click on New to create a Virtual Device, give it some Name and select Target Android Platform from the drop down list
  3. Click “Create AVD” and we are done!

Note: API Levels generally mean that as a programmer, you can communicate with the devices’ built in functions and functionality. Choosing an API level for an application development should take at least two things into account:

  1. Current distribution – How many devices can actually support my application, if it was developed for API level 9, it cannot run on API level 8 and below, then “only” around 60% of devices can run it (true to the date this post was made).
  2. Choosing a lower API level may support more devices but gain less functionality for your app. you may also work harder to achieve features you could’ve easily gained if you chose higher API level.

Mocking location data

As you develop your application, you’ll certainly need to test how well your model for obtaining user location works. This is most easily done using a real Android-powered device. However, if you don’t have a device, you can still test your location-based features by mocking location data in the Android emulator.

Select Window > Show View > Other > Emulator Control.

In the Emulator Control panel, enter GPS coordinates under Location Controls as individual latitude and longitude coordinates, with a GPX file for route playback, or a KML file for multiple place marks. (Be sure that you have a device selected in the Devices panel—available from Window > Show View > Other > Devices.)


Note: Providing mock location data is injected as GPS location data, so you must request location updates from GPS_PROVIDER in order for mock location data to work.

nilan avtar

Nilanchala

I'm a blogger, educator and a full stack developer. Mainly focused on Java, Spring and Micro-service architecture. I love to learn, code, make and break things.