Application Development With Android Operating System
Application Development With Android Operating System
2
Introduced by open handset alliance (OHA) in Nov,2007
devices
new APK
C++ support
6
Features of Android Operating System
General Connectivity
– Messaging : SMS, MMS Bluetooth
– Web browser: chrome tethering
– Voice based features Media
– Multi-touch Streaming media support
– Multitasking Media support: WAV, JPEG,
PNG, GIF, MP3, WEBM
– Screen capture
External storage: USB HDDs,
– Tv recording FAT32
– Video calling Hardware support:
– accessibility video cameras, touchscreens,
GPS, accelerometers, gyroscop
es, barometers,
magnetometers, 7
Categories of Android applications
1. Linux kernel
2. Native libraries (middleware)
3. Android Runtime
4. Application Framework
5. Applications
9
10
1) Linux kernel
• It is the heart of android architecture that exists at the root of
android architecture.
• Linux kernel is responsible for device drivers, power
management, memory management, device management and
resource access.
2) Native Libraries
• On the top of linux kernel, their are Native libraries such as
WebKit, OpenGL, FreeType, SQLite, Media, C runtime
library (libc) etc.
• The WebKit library is responsible for browser support, SQLite
is for database, FreeType for font support, Media for playing
and recording audio and video formats. 11
3) Android Runtime
• In android runtime, there are core libraries and DVM (Dalvik Virtual Machine)
which is responsible to run android application. DVM is like JVM but it is
optimized for mobile devices. It consumes less memory and provides fast
performance.
4) Android Framework
• On the top of Native libraries and android runtime, there is android framework.
Android framework includes Android API's such as UI (User Interface),
telephony, resources, locations, Content Providers (data) and package managers.
It provides a lot of classes and interfaces for android application development.
5) Applications
• On the top of android framework, there are applications. All applications such as
home, contact, settings, games, browsers are using android framework that uses
android runtime and libraries. Android runtime and native libraries are using
Linux kernel.
12
Android Core Building Blocks/Application Components
13
Activity
14
Intent
15
Service
16
Content Provider
18
Fragment
20
Android Emulator Quick-Start Guide
21
Create a new Emulator
Open Android Studio and start AVD manager located
in Tools > Android > AVD Manager
22
Con’t….
The AVD Manager will load the list of already installed
system images (if any)
provide you an option to create new emulator via Create
Virtual Device button
23
Con’t…
Select Hardware screen. A list of device definitions will
load. Choose the preferred device from the Phone tab and
press Next.
24
Con’t…
Then you get list of available system images
To be able to create an emulator, the system image must be
downloaded locally.
Press Download to obtain the image
25
Con’t…
Once the system image is successfully downloaded and
unzipped, press Finish.
26
Con’t…
The System Image screen will appear again with the
downloaded system image. Select the system image and
press Next.
27
Con’t…
The final configuration screen will load. When all settings
are set and ready press Finish.
28
Con’t…
The newly created Android Virtual Device is now listed in
the AVD Manager.
Select the system image and press the green arrow to the
right to manually start the emulator.
29
Android DDMS Quick-Start Guide
37
Project Structure
Library modules
38
Con’t…
All the build files are visible at the top level under Gradle
Scripts and each app module contains the following folders:
– manifests: Contains the AndroidManifest.xml file.
– java: Contains the Java source code files, including JUnit
test code.
– res: Contains all non-code resources, such as XML
layouts, UI strings, and bitmap images.
39
40
The Manifest File
Your application must declare all its components in this
file, which must be at the root of the application project
directory.
The manifest does a number of things in addition to
declaring the application's components, such as:
– Identify any user permissions the application requires
– Declare the minimum API Level required by the application
– Declare hardware and software features used or required by
the application
– API libraries the application needs to be linked against
41
Declaring Components
The primary task of the manifest is to inform the system about the
application's components. For example, a manifest file can declare an
activity as follows:
Activities, services, and content providers that you include in your source
but do not declare in the manifest are not visible to the system and,
consequently, can never run.
42
Con’t
Android Projects
– An application project is the main type of project and the
contents are eventually built into an .apk file that you install
on a device.
Test Projects
– These projects contain code to test your application projects
and are built into applications that run on a device.
Library Projects
– These projects contain shareable Android source code and
resources that you can reference in Android projects.
– Library projects cannot be installed onto a device, however,
they are pulled into the .apk file at build time.
43
res
Contains application resources, such as
– drawable files,
– layout files, and string values
44
Security
The Android operating system is a multi-user Linux system in
which each application is a different user.
Each process has its own virtual machine (VM), so an
application's code runs in isolation from other applications.
An application can request permission to access device data
such as the user's contacts, SMS messages, the mountable
storage (SD card), camera, Bluetooth, and more.
All application permissions must be granted by the user at install
time.
45
Build Process
46
Android Versions
47