Professional Documents
Culture Documents
Mobile Application-Chapter-III
Mobile Application-Chapter-III
Operating System
1
What is Android ?
2
• Introduced by open handset alliance (OHA) in
Nov,2007
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
Media support: WAV, JPEG,
– Multitasking
PNG, GIF, MP3, WEBM
– Screen capture External storage: USB HDDs,
– Tv recording FAT32
– Video calling • Hardware support:
– accessibility video cameras, touchscreens,
GPS, accelerometers, gyrosco
pes, barometers,
magnetometers, 7
Categories of Android applications
1. Linux kernel
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 kernal.
12
Android Core Building Blocks/Application Components
13
Activity
• An activity is a class that represents a single screen
with a user interface, in-short Activity performs
actions on the screen.
• It is like a Frame in AWT
• For example, an email application might have one
activity that shows a list of new emails, another
activity to compose an email, and another activity
for reading emails.
• An activity is implemented as a subclass
of Activity class as follows
14
Intent
• Intent is used to invoke components. It is mainly
used to:
– Start the service
– Launch an activity
– Display a web page
– Display a list of contacts
– Broadcast a message
– Dial a phone call etc.
15
Service
16
Content Provider
• Content Providers are used to share data between the
applications.
• A content provider component supplies data from one
application to others on request. Such requests are
handled by the methods of the ContentResolver class.
• You can store the data in the file system, an SQLite
database, on the web, or any other persistent storage
location your application can access.
• Through the content provider, other applications can
query or even modify the data (if the content provider
allows it).
17
Broadcast receivers
18
Fragment
• Fragments are like parts of activity. An activity can
display one or more fragments on the screen at the
same time.
AndroidManifest.xml
• It contains information's about activities, content
providers, permissions etc.
• It is like the web.xml file in Java EE.
Install Android
19
Android Virtual Device (AVD)
20
Android Emulator Quick-Start Guide
• Android Virtual Device (AVD)
– Eases the development process by providing an option
to test mobile applications on various virtual devices.
• So lets see how to create a new emulator to
test our application
21
Create a new Emulator
• Open Android Studio and start AVD manager located
in Tools > 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
• The Dalvik Debug Monitor Server (DDMS) is a
debugging tool provided with the Android Software
Development Kit (SDK).
• Developers use DDMS to provide a window into the
emulator or the actual device for debugging purposes
as well as file and process management.
• It’s a blend of several tools: a task manager, a profiler,
a file explorer, an emulator console, and a logging
console.
• If you use the Android IDE, the DDMS tool is tightly
integrated with your development environment as a
perspective.
30
31
Android Debug Bridge Quick-Start Guide
• Android Debug Bridge, is a command-line utility
included with Google's Android SDK.
• can control your device over USB from a computer,
copy files back and forth, install and uninstall apps,
run shell commands, and more
• Android Debug Bridge (adb) is a versatile command-
line tool that lets you communicate with a device.
• It is a client-server program that includes three
components:
• Client
• Daemon
• Server
32
Con’t…
– A client, which sends commands. The client runs on
your development machine.
– A daemon (adbd), which runs commands on a
device. The daemon runs as a background process
on each device.
– A server, which manages communication between
the client and the daemon. The server runs as a
background process on your development machine
• Android Studio does not contain ADB, you
need Android SDK for it (it is installed on first run
of Android Studio 0.9.x and newer).
• ADB is located in sdk\platform-tools .
• It's possible to add to PATH in Windows and use Terminal
inside Android Studio only by command:
adb shell and after use get root shell.
33
Enable adb debugging on your device
• Enable USB debugging in the device system settings,
under Developer options.
• On Android 4.2 and higher, the Developer options
screen is hidden by default. To make it visible, go to
Settings > About phone and tap Build number seven
times.
• You can now connect your device with USB.
• You can verify that your device is connected by
executing adb devices from the android_sdk/platform-
tools/ directory.
• If connected, you'll see the device name listed as a
"device."
34
Android Studio IDE Tips and Tricks
36
Activating Components
• A unique aspect of the Android system design is
that any application can start another application’s
component.
• Three of the four component types—activities,
services, and broadcast receivers—are activated by
an asynchronous message called an intent.
37
Project Structure
38
Con’t…
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:
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
Thank You
?
48