4. Android architecture… 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, allows Android to take advantage of key security features and
allows device manufacturers to develop hardware drivers for a well-known kernel.
5. Platform Architecture: 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 hardware abstraction layer (HAL) provides standard interfaces that expose device hardware
capabilities to the higher-level Java API framework.
When a framework API makes a call to access device hardware, the Android system loads the library
module for that hardware component.
6. Platform Architecture: Android Runtime
The hardware abstraction layer (HAL) provides standard interfaces that expose device hardware capabilities to the
higher-level Java API Framework.
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 is written to run multiple virtual machines on low-memory devices by executing DEX files, a bytecode format
designed specially for Android that's optimized for minimal memory footprint.
Prior to Android version 5.0 (API level 21), Dalvik was the Android runtime.
If your app runs well on ART, then it should work on Dalvik as well, but the reverse may not be true.
Android also includes a set of core runtime libraries that provide most of the functionality of Java programming
language.
7. Platform Architecture: Native C/ C++ Libraries
Many core Android system components and services, such as ART and HAL, are built from native code that require
native libraries written in C and C++.
The Android platform provides Java framework APIs to expose the functionality of some of these native libraries to
apps.
For example, you can access OpenGL ES through the Android framework’s Java OpenGL API to add support for
drawing and manipulating 2D and 3D graphics in your app
If you are developing an app that requires C or C++ code, you can use the Android NDK to access some of these
native platform libraries directly from your native code.
8. Platform Architecture: 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:
1. 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
2. A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files
3. A Notification Manager that enables all apps to display custom alerts in the status bar
4. An Activity Manager that manages the lifecycle of apps and provides a common navigation back stack
5. . Content Providers that enable apps to access data from other apps, such as the Contacts app, or to share their own data
9. Platform Architecture: 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 your app would like to deliver an SMS message, 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
10. Framework Definition
A framework in programming is a tool that
provides ready-made components or
solutions that are customized in order to
speed up development.
11. Android Frameworks
Today’s society lives a completely app-dependent life: our daily routines, working, or studying habits completely depend on
tons of different applications installed on our Android or iOS device.
We will discuss some of the most popular Android frameworks, the features they offer as well as the projects they’ll best fit
too.
Some of the frameworks we already have discussed in previous lecture:
JQuery Mobile
Worklight
Sencha Touch
JQT (Formerly Known As JQtouch)
12. Ionic Framework: Ionic is a free and open-source Android framework certified by MIT ( Massachusetts Institute of
Technology) and allows developers to build progressive hybrid apps with the help of HTML5, CSS3, and JavaScript.
Ionic has become one of the most famous frameworks for Android development due to its cross-platform
functionalities and the ability to integrate AngularJS.
This Android framework hosts a simple CLI (Command-line Interface) that facilitates features like emulators, live
reload, and logging.
Around 4 million Ionic-based apps were built, with more than 5 million developers in over 200 countries worldwide
using the framework. Moreover, it integrates with many services, including Google Play, Instagram, and other
platforms.
13. Android Application Development
To get into the Android Application Development, we need to understand the
following:
Android Activity Lifecycle
Basic Components of Android App
14. Activity Lifecycle
As a user navigates through, out of, and
back to your app, the Activity instances in
your app transition through different states
in their lifecycle.
The Activity class provides a number of
callbacks that allow the activity to know
that a state has changed: that the system is
creating, stopping, or resuming an activity,
or destroying the process in which the
activity resides.
15. To navigate transitions between stages of the
activity lifecycle, the Activity class provides a
core set of six callbacks:
onCreate() ,
onStart() ,
onResume() ,
onPause() ,
onStop() ,
onDestroy().
16. Doing the right work at the right time and handling transitions properly make your app more robust and
performant.
For example, good implementation of the lifecycle callbacks can help ensure that your app avoids:
Activity Lifecycle
Crashing if the user receives a phone call or switches to another app while using your app.
Consuming valuable system resources when the user is not actively using it.
Losing the user's progress if they leave your app and return to it at a later time.
Crashing or losing the user's progress when the screen rotates between landscape and portrait orientation.
17. The manifest file
Before the Android system can start an app component, the system must know that the component exists by reading the app's manifest file,
AndroidManifest.xml.
Your app must declare all its components in this file, which must be at the root of the app project directory.
The manifest file does a number of things in addition to declaring the app's components, such as the following:
Identifies any user permissions the app requires (GPS, Camera, etc.)
Declares the minimum API Level required by the app.
Declares Hardware or Software features used/ required (i.e. camera, bluetooth, etc.)
Declares API libraries the app needs to be linked against (other than the Android framework APIs), such as the Google Maps library.
18. Building Blocks of Android
Android apps are built as a combination of components that can be invoked individually.
For example, an activity is a type of app component that provides a user interface (UI).
The "main" activity starts when the user taps your app's icon.
App components are the essential building blocks of an Android app.
Each component is an entry point through which the system or a user can enter your app.
Some components depend on others.
There are four different types of app components:
Activities
Services
Broadcast receivers
Content providers
19. Building Blocks of Android: Activities
Activities are the basic entry point for
interacting with the user.
It represents a single screen (UI).
Although the activities work together to
form a cohesive user experience in the app,
each activity is independent of the others.
20. Building Blocks of Android: Services
Services are general-purpose entry point,
but runs in the background.
NO (UI) user interface .
User are mostly unaware about running of
services in background.
Live wallpapers, notifications, screen
savers, are all built as services.
21. Building Blocks of Android: Broadcast Receivers
Broadcast receivers allows you to register
for system or application events.
Don't display UI, they may create a status
bar notification to alert the user when a
broadcast event occurs.
22. Building Blocks of Android: Content Providers
Content providers manages app data that
you can store in the file system, in a SQLite
database, on firebase, on the web, or on
any other storage location that your app
can access.
23. Building Blocks of Android: Activating Components
Activities, Services, and Broadcast Receivers, are activated by an asynchronous message called an
INTENT.
Intents bind individual components to each other at runtime.
An intent is created with an Intent object, which defines a message to activate either a specific component
(explicit intent) or a specific type of component (implicit intent).
Content Providers are not activated by intents.
Rather, they are activated when targeted by a request from a ContentResolver