Related Posts Plugin for WordPress, Blogger...

Friday 16 September 2011

How Android works: The big picture

Summary: Some parts of Android will be familiar, such as the Linux Kernel, OpenGL, and the SQL database. Others may be completely foreign, such as Android’s idea of the application life cycle. You’ll need a good understanding of these key concepts in order to write well-behaved Android applications. Let’s start off by taking a look at the overall system architecture–the key layers and components that make up the Android stack. Excerpted from an upcoming book.


Some parts of Android will be familiar, such as the Linux Kernel, OpenGL, and the SQL database. Others may be completely foreign, such as Android’s idea of the application life cycle. You’ll need a good understanding of these key concepts in order to write well-behaved Android applications.




Let’s start off by taking a look at the overall system architecture–the key layers and components that make up the Android stack. The following diagram (courtesy of Google) shows the “20,000 foot” view of Android:
How Android works: The big picture
Starting at the bottom is the Linux Kernel. Android uses Linux for its device drivers, memory management, process management, and networking. However you will never be programming to this layer directly.
The next level up contains the Android native libraries. They are all written in C/C++ internally, but you’ll be calling them through Java interfaces. In this layer you can find the Surface Manager (for compositing windows), 2D and 3D graphics, Media codecs (MPEG-4, H.264, MP3, etc.), the SQL database (SQLite), and a native web browser engine (WebKit).
Next is the Android runtime, including the Dalvik Virtual Machine. Dalvik runs dex files, which are coverted at compile time from standard class and jar files. Dex files are more compact and efficient than class files, an important consideration for the limited memory and battery powered devices that Android targets.
The core Java libraries are also part of the Android runtime. They are written in Java, as is everything above this layer. Here, Android provides a substantial subset of the Java 5 Standard Edition packages, including Collections, I/O, and so forth.
The next level up is the Application Framework layer. Parts of this toolkit are provided by Google, and parts are extensions or services that you write. The most important component of the framework is the Activity Manager, which manages the life cycle of applications and a common “back-stack” for user navigation.
Finally, the top layer is the Applications layer. Most of your code will live here, along side built-in applications such as the Phone and Web Browser.
One of the unique and powerful qualities of Android is that all applications have a level playing field. What I mean is that the applications Google writes have to go through the same public API that you use. You can even tell Android to make your application replace the standard applications if you like.

0 comments

Post a Comment