Introduction To Mobile Computing With Android: Prof. Manish Kumar Joshi, Assistant Professor
Introduction To Mobile Computing With Android: Prof. Manish Kumar Joshi, Assistant Professor
Introduction To Mobile Computing With Android: Prof. Manish Kumar Joshi, Assistant Professor
with Android
Prof. Manish Kumar Joshi, Assistant Professor
IT & Computer Science
CHAPTER-2
Getting Started with Android
Overview
Android is a Linux based operating system it is designed primarily for
touch screen mobile devices such as smart phones and tablet computers.
The operating systems have developed a lot in last 15 years starting from
black and white phones to recent smart phones or mini computers. One of
the most widely used mobile OS these days is android. The android is
software that was founded in Palo Alto of California in 2003.
Android Architecture
The android is a operating system and is a stack of software components
which is divided into five sections and four main layers that is
• Linux Kernel
• Libraries
• Android Runtime
• Application Framework
Linux Kernel
The android uses the powerful Linux kernel and it supports wide range
of hardware drivers. The kernel is the heart of the operating system that
manages input and output requests from software. This provides basic
system functionalities like process management, memory management,
device management like camera, keypad, display etc the kernel handles
all the things. The Linux is really good at networking and it is not
necessary to interface it to the peripheral hardware. The kernel itself
does not interact directly with the user but rather interacts with the shell
and other programs as well as with the hard ware devices on the
system.
Application Framework
Libraries
• Platform-tools
• Build-tools
• SDK-tools
• The Android Debug Bridge (ADB)
• Android Emulator
Using SDK Manager
The Android Device Monitor encapsulates DDMS and can be found under
– you guessed it – Tools — Android — DDMS. This works with either an
emulator or a connected device and will go a little deeper in monitoring the
way your Android device and app are behaving.
Using ADB
• It supports wireless communication using 3G, 4G, 5G, Wi-Fi, EDGE and
Bluetooth networks.
• It is Linux based and open-source.
• It has Media and Storage support.
• It supports all Google services like Gmail, Chrome, Location manager,
Google maps, Drive, play Store etc.
• It supports multitasking and many more.
Android Studio Installation & Setup: Step 0
1. Installing Java
Development Kit
2. Set environment
variable “JAVA_HOME”
to JDK installation
directory.
Step 1 (for Windows)
1. Goto
developers.android.co
m/studio and download
android studio
2. After downloading
studio, launch android
studio and continue to
next steps.
Step 1 (for MacOS)
1. Goto
developers.android.co
m and click on
download options and
select the android
studio for macOS , the
one with .dmg file
extension.
2. Launch the installation
file and continue to the
next steps.
Step 2
1. Launching android studio for the
first time, it will run setup wizard
a) Choose “don’t import
previous settings”
b) In “welcome”, choose “next”
c) In “install type”, choose
“standard”
d) Select UI theme.
2. In SDK setup make sure virtual
device is selected and carry on
to the installation steps.
Step 3
Set up Emulator
1. In android studio select “Tools” -> Android -> AVD manager
2. Choose a device
3. Select and system image
4. Verify configuration, finish.
Android Manifest File
Every project in Android includes
a manifest file, which is
AndroidManifest.xml, stored in
the root directory of its project
hierarchy. The manifest file is an
important part of our app
because it defines the structure
and metadata of our application,
its components, and its
requirements.
AndroidManifest.xml
This file includes nodes for
each of the Activities, Services,
Content Providers and
Broadcast Receiver that make
the application and using Intent
Filters and Permissions,
determines how they co-
ordinate with each other and
other applications.
AndroidManifest.xml
A manifest file includes the nodes that define the application components,
security settings, test classes and requirements that make up the
application. Some of the manifest sub-node tags that are mainly used are:
• uses-sdk
• uses-configuration
• uses-features
• permission
• support-screens
• intent-filters
• application
Android LifeCycle
As a user navigates through the app, Activity instances in your app
transition through different stages in their life-cycle. 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.
Android LifeCycle
LifeCycle Methods
In general, activity lifecycle has seven callback methods:
1. onCreate()
2. onStart()
3. onResume()
4. onPause()
5. onStop()
6. onRestart()
7. onDestroy()
Android LifeCycle
When you open the app it will go through below states:
onCreate() –> onStart() –> onResume()
When you press the back button and exit the app
onPaused() — > onStop() –> onDestory()
When you press the home button
onPaused() –> onStop()
After pressing the home button, again when you open the app from a
recent task list
onRestart() –> onStart() –> onResume()
After dismissing the dialog or back button from the dialog
onResume()
Android LifeCycle
If a phone is ringing and user is using the app
onPause() –> onResume()
After the call ends
onResume()
When your phone screen is off
onPaused() –> onStop()
When your phone screen is turned back on
onRestart() –> onStart() –> onResume()
www.paruluniversity.ac.in