blog

Home / DeveloperSection / Blogs / The Android API

The Android API

Manoj Bhatt1664 09-May-2016

Android is a fairly complex system, but we do not need to understand it in depth to be able to make amazing apps. The portion of the Android system which executes (runs) on the compiled DEX code is called the Dalvik Virtual Machine (DVM). The DVM itself is a piece of software implemented in different language that runs on a specific adapted version of the Linux operating system (OS). So what we user sees of Android, is itself just an application executing on another operating system (OS).                                                    

The major aim of the DVM is to hide the complexity and diversity of the hardware and software that Android executes on but, at the meantime, its purpose is to expose all of Android’s useful features. This exposing of features particularly works in two ways. The DVM itself must have access to all the hardware, which it does very well, but this access needs be programmer friendly and easy to use. The way the DVM allows us access is indeed easy to use, it is all because of the Android Application Programming Interface (API). 

The Android API is the code that makes it really easy to do exceptional things. A simple analogy could be drawn with a machine, perhaps a car. When we step on the accelerator, whole bunch of things starts happening under the hood. We don't require to understand about combustion and fuel pumps since a creative engineer has enabled an interface for us. In this case, a mechanical interface which is the accelerator pedals. Look and carefully observe the following line of Java code as an example; firstly, it will probably look a little intimidating if we are   a rookie or completely new to Android:

locationManager.getLastKnownLocation

(LocationManager.GPS_PROVIDER);

However, once we learn that this single line of code searches for the available satellites and then communicates with them in orbit around the Earth while retrieving our precise latitude and longitude on the planet, it is easy and simple to begin to glimpse the power and depth of the Android API in conjunction with the DVM. Even if the above code does look a little challenging at the moment, just think of talking to a satellite in some other way!

The Android API is basically a structured and designed collection of Java code. So, how do we make use of all this code to do cool stuff without getting swamped by its complexity? How do we find out to manipulate the pedals, steering wheel, and sunroof of the Android API? 


What the software programmer or developer really do when they write their code is build a blueprint for an object. We then instantiate (create) an object from their blueprint using Java code and, once we got that object, we can configure it, use it, combine it with other objects, and more. Also, we can design blueprints and make objects from them as well. The compiler then translates (manufactures) our custom-built creation into DEX code.


Leave Comment

Comments

Liked By