0% found this document useful (0 votes)
56 views

Android Architecture and Framework

The document provides an overview of the Android architecture including its key layers and components. The Android architecture consists of applications, frameworks, Android runtime, libraries and the Linux kernel. The frameworks provide APIs for applications to access hardware and services. Applications run on the Android runtime which uses Dalvik or ART for execution. The Linux kernel provides low-level functionality. Popular architectures for Android apps include MVC, MVP and MVVM. Modern architectures separate the UI, domain and data layers.

Uploaded by

mahrukhkhan702
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Android Architecture and Framework

The document provides an overview of the Android architecture including its key layers and components. The Android architecture consists of applications, frameworks, Android runtime, libraries and the Linux kernel. The frameworks provide APIs for applications to access hardware and services. Applications run on the Android runtime which uses Dalvik or ART for execution. The Linux kernel provides low-level functionality. Popular architectures for Android apps include MVC, MVP and MVVM. Modern architectures separate the UI, domain and data layers.

Uploaded by

mahrukhkhan702
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Android Architecture

and Framework
Ms. Maryam Sajjad
Platform Architecture

 Android is an open source, Linux-based software stack


created for a wide array of devices and form factors.

 The simple definition of Android app architecture depends


on the focus of building web applications.

 Technically, architecture is the skeleton of any app,


including its features, elements, database systems, servers,
and all the communication happening between them.
Android Architecture
(The Layers,
The Frameworks,
The Components)
Android Architecture
 Android applications are run on Dalvik Virtual Machine (DVM),
one of the Linux Kernel components that provide the operating
system’s primary functionality.

 Architecture refers to how elements within an app interact


with one another and how they interact with major elements
and components.

 And it facilitates the management of algorithm details and


implementation details for each component.
Components of Android Architecture

Applications

Frameworks

Android Runtime

Different libraries

Hardware Abstraction Layer

Linux Kernel
Linux Kernel
 The foundation of the Android platform is the Linux kernel. For
example, the Android Runtime (ART) relies on the Linux kernel for
underlying functionalities such as threading and low-level memory
management.

 Using a Linux kernel lets Android take advantage of key security


features and lets device manufacturers develop hardware drivers
for a well-known kernel.
Hardware abstraction layer (HAL)
 The hardware abstraction layer (HAL) provides standard
interfaces that expose device hardware capabilities to the
higher-level Java API framework.
 The HAL consists of multiple library modules, each of
which implements an interface for a specific type of
hardware component, such as the camera or Bluetooth
module. When a framework API makes a call to access
device hardware, the Android system loads the library
module for that hardware component.
Android Runtime

• Supports writing and running Android applications.


• Two Main Components;
1. Core Java Libraries
2. Dalvik Virtual Machine
Android Runtime
 For devices running Android version 5.0 (API level 21) or
higher, each app runs in its own process and with its own
instance of the Android Runtime (ART).

 ART is written to run multiple virtual machines on low-


memory devices by executing Dalvik Executable format
(DEX) files, a bytecode format designed specifically for
Android that's optimized for a minimal memory footprint.
Android Runtime: Core Java Libraries

• Basic Java Classes– Java.*, Javax.*


• Application Lifecycle– Android.*
• Internet/ Web Services– Org.*
• Unit Testing– Junit.*
Android Runtime: Dalvik Virtual
Machine (Version Android 4.4 below)
• Apps are executed by the Dalvik Virtual Machine(Software)
Typical Workflow:
1. App written in Java
2. Compiled to Java Bytecode files for Java Virtual Machine
(JVM)
3. DX (tool) converts Java Bytecode files to a single Dex
Bytecode file (Classes.dex) and Optimized
DalvikExecutable files (Classes.odex)
4. When user launches app, Dalvik executes Dex Bytecode file
Android Runtime: Dalvik Virtual
Machine (Cont...)
• Designed for resource-constrained environments
– Slower CPU
– Less RAM
– Limited Battery Life
Java API Framework

 The entire feature-set of the Android OS is available to you through APIs written
in the Java language. These APIs form the building blocks you need to create
Android apps by simplifying the reuse of core, modular system components and
services, which include the following:
 A rich and extensible view system you can use to build an app’s UI, including lists,
grids, text boxes, buttons, and even an embeddable web browser
 A resource manager, providing access to non-code resources such as localized strings,
graphics, and layout files
 A notification manager that enables all apps to display custom alerts in the status bar
 An activity manager that manages the lifecycle of apps and provides a common
navigation back stack
 Content providers that enable apps to access data from other apps, such as the
Contacts app, or to share their own data
 Developers have full access to the same framework APIs that Android system apps use.
Java API framework
• Contains re-usable software that many mobile applications are likely to need
API interface
• View System– common graphical/user interface elements like buttons, icons etc.
• Package Manager– keeps track of app packages on device.
• Window Manager– manages the windows comprising an app.
• Resource Manager– manages non-compiled resources e.g. Strings, graphics & layout files.
• Activity Manager– manages app lifecycle and navigation stack .
• Content Provider– inter-application data sharing.
• Location Manager– provides location & movement information.
• Notification Manager– place notifications in the status bar when important events occur.
• Telephony Manager– Provides access to telephony services as well as some subscriber information, such as phone
numbers.
System apps
 Android comes with a set of core apps for email, SMS messaging,
calendars, internet browsing, contacts, and more. Apps included
with the platform have no special status among the apps the user
chooses to install. So, a third-party app can become the user's
default web browser, SMS messenger, or even the default keyboard.
Some exceptions apply, such as the system's Settings app.

 The system apps function both as apps for users and to provide key
capabilities that developers can access from their own app. For
example, if you want your app to deliver SMS messages, you don't
need to build that functionality yourself. You can instead invoke
whichever SMS app is already installed to deliver a message to the
recipient you specify.
Remember!

 Each project follows a different mobile app architecture;


now, you must consider which Android architecture is the
best and which design patterns developers should follow
for better results.
Android App Architectures
Popular Android App Architectures

 Model-View-Controller (MVC)
 Model-View-Presenter (MVP)
 Model-View –View Model (MVVM)
 And many others
Model-View-Controller (MVC)
 Given that it is utilized by numerous
programming languages, including Python,
Java, and Swift, this architecture is the most
common in the development industry.

 It clearly distinguishes between the View,


which determines how to present data, the
Model, which determines how to organize the
data, and the Controller, which manages user
interaction. Android is primarily created so
that it may adhere to the MVC pattern.

 However, the Activity acts as both the View


and the Controller in Android’s MVC
implementation, violating the single
responsibility concept essential to this
architecture.
Model-View-Presenter (MVP)
 The MVP paradigm, where business logic was defined
inside classes called Presenters, was something that the
Android community started to use more frequently. When
the Activity interacts with the Presenter, the Presenter is
informed of user activities, and the View is inflated.
Model-View –View Model (MVVM)
 The main suggestions from Google support MVVM, utilizing
LiveData and View Models to address the two most
prevalent problems that Android apps encounter: lifecycle
and rotation-change difficulties.
 Applications can be flexible and straightforward to
maintain when logic and behavior are properly separated.
Layers of Modern Android Application
Architecture
Layers of Modern Android Application
Architecture
 UI Layer
 Puts data from the application on the screen. The UI Layer is typically
made up of two more compact parts (UI = UI Elements + UI State).
 Domain Layer
 This layer is optional; not all applications, particularly basic ones, require
a domain layer to manage reusable business logic or are too complex to
be contained entirely within the data layer. The business logic of an
application specifies the creation, storage, and modification of data.
 Data Layer
 Data sources and repositories are the two elements that make up the data
layer, which controls the majority of the application’s business logic.
Market share per Android
phone manufacturer
Top Android phone manufacturers
https://www.appbrain.com/stats/top-manufacturers
Android phone manufacturer Market share Change in the last 30 days
Samsung 33.7% 3.0%
Xiaomi 14.3% No change
Vivo 10.9% 6.1%
Oppo 10.8% 4.3%
Realme 4.8% 4.1%
Huawei 4.5% 3.3%
Amazon 3.2% 7.1% Market share
Motorola 2.7% 3.1%
Infinix mobility limited 1.4% 3.3% development
Tecno mobile limited 1.4% 4.9%
Honor 1.3% 16.3% per Android
Infinix
Tecno
1.3%
1.2%
11.7%
9.5% phone
Google 0.8%
OnePlus 0.8%
8.2%
2.4%
manufacturer
LG 0.6% 14.3%
Itel 0.5% 5.1%
Amlogic 0.5% 7.6%
Hmd global 0.4% 4.3%
Rockchip 0.4% 8.9%
The Android Market Application Store

 Most apps are distributed through Google's Play Store but


many alternative software repositories, or app stores,
exist. Alternative app stores use Android devices'
"Unknown Sources" option to install APK files directly via
the Android Package Manager.

Ref: https://en.wikipedia.org/wiki/List_of_Android_app_stores
List of Android Market Application Store

  Third-party app stores


Google Play Store (Most popular)
 Aptoide
 XDA Labs
 Manufacturer’s app store
 F-Droid
 Samsung Galaxy Store
 TapTap
 Amazon Appstore
 Cafe Bazaar
 Huawei AppGallery
 Myket
 Xiaomi Mi GetApps
 Proxy app store
 OPPO App Market
 There are also proxy app stores that act
 VIVO App Store
as a client for the Google Play store.
 Aurora Store
 Mobile.Softpedia.com

Ref: https://en.wikipedia.org/wiki/List_of_Android_app_stores
Android Project Structure
Project Structure
AndroidManifest.xml
– Overall project config and settings

src/…
– Source code for your Kotlin/Java classes

res/…
– drawable/ = images
– layout/ = descriptions of GUI layout
– strings/ = localization data
– styles/= general appearance styling

Gradle
– A build/compile management system
– build.gradle = main build config file
Virtual Devices (AVD)

• Emulator / software simulation of an Android device

• When you click “Run” in Android Studio, it builds your app,


installs it on the virtual device, and loads it.
• Must set up virtual device in Android Studio
• Alternative: install your app on your actual Android device!
– Pro: app runs faster, better “real” test
– Con: need device plugged into dev PC
APP Build Process

You might also like