Android Architecture

  • Android environment consists of a layered architecture that provides a framework for developing and running applications on mobile devices that allows for a modular and flexible design.
  • The architecture of Android includes various components that work together to deliver a robust and flexible platform.
  • The architecture is designed to enable developers to build applications that can run on various Android devices with different hardware specifications.
  • The primary components of the Android architecture are:
    1. Linux Kernel:
      • Linux kernel is considered as the heart of android architecture that exists at the root of android architecture.
      • Android is built on top of the Linux kernel, which provides core components of the system and provides services such as process management, power management, memory management, device management, resource access, security, and device drivers.
      • The Linux kernel acts as a hardware abstraction layer, allowing Android to run on a wide range of devices.
    2. Android Runtime (ART):
      • Android Runtime (ART) is the virtual machine (VM) used by the Android operating system to run applications written in the Java programming language.
      • It is the successor to the older Dalvik runtime, which was used in versions of Android prior to Android 5.0 (Lollipop).
      • Android Runtime was introduced in Android 4.4 (KitKat) as an experimental feature and became the default runtime in Android 5.0.
      • Now, Android Runtime has contributed to improved app performance and stability on Android devices, and it continues to be the default runtime in modern versions of the Android operating system. 
      • There are some characteristics and improvements of Android Runtime (ART) compared to Dalvik:-
        • Core libraries and DVM tools: In Android runtime, there are several core libraries and DVM tools (Dalvik Virtual Machine) which is responsible to run Android application. DVM is like the JVM of Java and works similarly.
        • Ahead-of-Time (AOT) Compilation: ART uses an AOT compilation approach, which means that apps are compiled into native machine code when they are installed on the device. In contrast, Dalvik used Just-in-Time (JIT) compilation, which compiled code on the fly as it was executed. AOT compilation results in faster app startup times and better overall performance. ART uses Ahead-Of-Time (AOT) compilation to convert the application’s bytecode into native machine code during app installation, which improves app performance compared to the previous Dalvik runtime.
        • Improved Garbage Collection: ART introduced a more efficient garbage collection mechanism, reducing the frequency and duration of garbage collection pauses, resulting in smoother app performance.
        • Enhanced Runtime Profiling: ART includes advanced profiling tools that allow developers to gather performance data and optimize their apps better.
        • Reduced Memory Usage: By compiling apps into native code, ART reduces the memory footprint compared to the older Dalvik runtime.
        • Improved Security: ART implements various security enhancements, including better memory protection and isolation between apps.
        • Compatibility: ART maintains backward compatibility with apps designed for the Dalvik runtime, ensuring that older apps can run without issues on devices running ART.
        • Managed Runtime Environment: ART has the managed runtime environment used by Android applications. Hence, it executes the application code written in Java or Kotlin programming languages.
    3. Native C/C++ Libraries:
      • Android includes a set of native libraries written in C/C++ that provide various functionalities to the system and applications.
      • These libraries cover areas such as graphics rendering, multimedia, and networking.
      • Developers can also use the Android NDK (Native Development Kit) to build parts of their applications using native code.
      • These libraries cover areas such as graphics rendering (OpenGL ES), Media codecs, SQLite database, SSL encryption, and more.
    4. Hardware Abstraction Layer (HAL):
      • The HAL provides an interface between the Android framework and the hardware-specific drivers.
      • It allows the Android platform to be hardware agnostic(atheist), enabling the same Android OS to work on different devices with different hardware components.
    5. Android Framework:
      • The Android framework provides a set of APIs (Application Programming Interfaces) that allow developers to build applications on top of the Android operating system.
      • It includes various managers and services for activities, content providers, notifications, telephony, location, and more.
    6. System Apps & Services:
      • Android comes with a set of pre-installed system applications that provide core functionalities, such as the dialer, contacts, settings, and more.
      • These apps are part of the Android Open Source Project (AOSP).
    7. Application Layer:
      • This is where the user-installed applications reside.
      • Applications developed by developers or downloaded from the Google Play Store run at this layer.
      • Each application runs in a separate process, isolated from other applications for security and stability.
    8. User Interface (UI):
      • The UI layer includes the system’s graphical user interface, built using Android’s XML-based layout system.
      • It handles the rendering of app views and the user’s interaction with them.
    9. Google Play Services:
      • While not strictly part of the core Android architecture, Google Play Services is an important component for Android devices.
      • It provides additional APIs and services for Google features like Google Maps, Firebase, authentication, and more.
      • Most Android devices come with Google Play Services pre-installed.

Android APIs

  • As we know, Android applications are built using Java or Kotlin programming languages, and then they interact with the Android operating system through a set of APIs (Application Programming Interfaces). These APIs provide developers to access & interact with various system functionalities, services, and hardware components on the device such as accessing hardware sensors, managing network connections, handling user interface elements, and more.
  • The Android API is organized into a set of packages and classes that developers can utilize to build Android applications.
  • It’s important to note that the Android platform continually evolves, and new APIs are introduced with each major Android version release as per requirements.
  • Below are some essential Android APIs which cover a wide range of areas, including:-
    • App Components APIs:
      • These APIs are helpful for creating and managing activities, services, broadcast receivers, and content providers.
    • Activity and Fragment APIs:
      • These APIs enable the creation of user interface components, handling user interactions, and managing the app’s lifecycle.
    • User Interface APIs:
      • These APIs are used for creating interactive user interfaces, including views, layouts, and dialogs.
    • Intents related APIs:
      • Intents-related APIs facilitate communication between components within an application or between different applications.
      • They are used to start activities, services, or broadcast messages.
    • Permissions-related APIs:
      • Android’s permission system allows apps to request access to sensitive data or device features, such as the camera, microphone, location, etc.
    • Content Providers APIs:
      • Content Provider’s APIs allow applications to share data with other apps and provide a structured way to access data from a central repository.
    • Background Service APIs:
      • Services are background processes that can run independently of the UI.
      • Services APIs can help to perform tasks in the background including AsyncTask, threads, and services, even if the app is not in the foreground.
    • Broadcast Receivers APIs:
      • Broadcast receivers’ APIs allow apps to respond to system-wide events or custom broadcasts. For example, an app can react to the device’s battery status change.
    • Connectivity APIs:
      • These APIs for working with network connections, Wi-Fi, Bluetooth, and NFC (Near Field Communication).
    • Notifications APIs:
      • The Notification API enables developers to display notifications to the user in the status bar.
    • Networking APIs:
      • Android provides various APIs to perform network operations, including HTTP requests and handling network connections.
    • Storage APIs:
      • APIs for reading and writing data to internal and external storage.
      • In other words, these APIs are for data storage and retrieval, such as working with databases, files, preferences, and content providers.
    • Location & Map Services APIs:
      • These APIs help to access location information through GPS or network providers.
      • These APIs are for obtaining the device’s location, geocoding, and displaying maps.
    • Camera APIs:
      • These APIs help to interact with the device’s camera and capture photos or videos.
    • Sensors APIs:
      • These APIs of Android allow developers to access various hardware sensors on the device, such as accelerometers, gyroscopes, proximity sensors, ambient light sensors, etc.
    • Graphics APIs:
      • APIs for rendering 2D and 3D graphics.
    • MultiMedia APIs:
      • These APIs are for working with audio and video capturing, playback, and recording.
      • These APIs are also for working with images and accessing the camera.
    • Security APIs:
      • These APIs are for implementing security measures, including cryptography, secure network communication, and authentication.
    • In-app Billing:
      • These APIs are for integrating in-app purchases and subscriptions in applications.

Loading

Categories: Android

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.