Android Architecture

In this blog, I would be covering the most important part of Android i.e. Android Architecture and the internal components associated with it. Before starting my career in android development, I always used to run after Java language because it offers higher cross functionality and portability as programs are written on one platform can run on desktops, mobiles, embedded systems. 3 years back Android had already made inroads in the IT industry and somewhere I was lured towards it since its basics are based on Java. So From Day 1, I was eager to learn how android functions, why android uses Dalvik Virtual machine(DVM), Android Libraries, Application Framework, Android Components and many more features associated with this beautiful language.

Before learning any language it’s a must to know the architecture of that language, so let’s discuss Android architecture first.

android architecture
android architecture

Android Architecture can be categorized into Linux Kernel, Android Libraries, Android Runtime, Android Application Framework and Android Components. Let’s discuss them one by one :

  • Linux Kernel
    1. Android relies on Linux version 3.6 for core system services such as security, memory management, process management, network stack and driver model.
    2. Kernel acts as an abstraction layer between the hardware and the rest of the software stack.
    3. Device Drivers include Display, Camera, Keypad, Wifi, Flash Memory, Audio and IPC ( inter process communication).
  1. Android Libraries
    1. System C library
      • A BSD-derived implementation of the standard C system library(libc), tuned for embedded Linux-based devices
    2. Media Libraries
      • It is based on Packet Video’s Open Core. The libraries support playback and recording of many popular audio and video formats, as well as static images files, including MPEG4, H.264, MP3, JPG and PNG.
    3. Surface Manager
      • It manages access to the display sub system and seamlessly composites 2D and 3D graphic layers from multiple applications.
    4. LibWebCore
      • It is a modern web browser engines which power both the Android browser and an embeddable web view.
    5. SGL
      • The underlying 2D graphics engine.
    6. FreeType
      • Bitmap and vector font rendering
    7. SQLite
      • A powerful and lightweight relational database engine available to all application.
  1. Android Application Framework
    • Each process has its own Java Virtual Machine (VM)
    • Each application is assigned a unique Linux user ID, although it is possible to have two processes share the same user ID, in that case the two processes can see each other’s files.
    • An android application can make use of elements of other application.
    • Android application don’t have a single entry point for everything in the application, they have essential components that system can instantiate and run as needed.
  • Android Components
      1. Activities
        • Activities are the building block of the user interface.
        • Each Activity is implemented as the derived class of ACTIVITY class
        • In Android, an application can have multiple activities and among them one activity is marked as the first activity which would be presented to the user during the application startup. This particular activity can invoke more activities.
        • The content of the window of activity is derived from the base VIEW class.
        • Parent view contain and organize the layout of their children.
        • Android has number of ready-to-use views that you can use like Button, Text View ,Edit Text, Check Boxes etc.
        • A View hierarchy is placed within activity window by calling the activity method setContentView(View view) method.
      2. Services
        • A service doesn’t have a user interface and its purpose is to run in background for long period of time
        • Each service extend the base SERVICE class. For example while user is busy playing a game, the app might fetch the data over network for the next level of the game or calculate something and provide the result to activity that need it.
        • Like activities and other components, services run in the main thread of application process.
      3. Broadcast Receivers
        • A broadcast receiver is a component that receives and reacts to broadcast announcements.
        • Applications can also initiate broadcasts in order to let other application know that some action has taken place. For example some data has been downloaded.
        • Broadcast receiver do not have a user interface. However, they may start an activity in response to the information they receive.
        • The Local Broadcast Manager was introduced to the Android Support Library to simplify the process of registering for, and sending, Broadcast Intents between components within your application.
      4. Content Providers
        • A content provider makes a specific set of application data available to other application.
        • The data can be store in the file system, in an SQLite database or in any other format.
        • The content provider extend the Base class ContentProvider to implement a standard set of methods that enable other applications to retrieve and store data.
        • These methods are not called directly by the classes of different application but they use ContentResolver object and call its method instead to retrieve that data.

So with this, now you have a better understanding of Android architecture and how things move around in Android. In case you have any query or need suggestion you can reach out to me or leave your comment below.