This document provides an overview of mobile application development using Android. It discusses Android's architecture including the Linux kernel layer, libraries layer, Android runtime layer, application framework layer, and applications layer. It describes key Android components like activities, services, broadcast receivers, content providers, and intents. It also covers the Android development process, tools, requirements and versions.
3. Compulsory Reading Material
• The Android™ Developer’s Cookbook-Building
Applications with the Android SDK,
• by Ronan Schwarz, Phil Dutson, James
Steele, Nelson To (2nd Edition)
• Learning Android (O’Reilly publisher) by Marko
Garenta
Prerequisites
Assessment & Evaluation Criteria
• Quizzes 10 %
• Assignments 10 %
• Mid Term 20 %
• Project 10 %
• Final Term 50 %
• Total: 100 %
• Object Oriented Programming using Java
4. Android Overview
•Android (Google) is a widely anticipated open
source operating system for mobile devices,
•Supporting
Bluetooth (wireless for short distance)
Wi-Fi (wireless for 150 feet indoors, 300 ft outdoors)
3G(200 kbits/sec) and 4G (100 Mbit -1Gbit/sec)
•Android software stack
–Android Linux operating system
–Middleware(Dalvik Runtime Optimized Java virtual
machineVM, Java API) and Library(Phone, contact,
GPS map, SQLite, OpenGL.)
6. Linux kernel Layer
• Android relies on Linux kernel
• Supplies management of security, memory
process, network, and drivers
• Acts as an abstraction layer between the
hardware and the rest of the Android software
stack
7. Library Layer
• System C libraries and function Libraries, supporting
multimedia, web browser, SQLite... Native Services to
hardware
• Android runtime
Dalvik Virtual Machine
– Executes files in the Dalvik Executable (.dex) format
Java core Libraries
– Provides most of the functionality of the Java
programming language.
Java core libraries rely on the Dalvik VM and the
underlying Linux kernel
Every Android application runs in its own process, with
its own instance of the Dalvik virtual machine
8. Application Framework Layer
• Simplify the reuse of components
– Applications can publish their capabilities and any
other application may then make use of those
capabilities
• Applications is a set of services
– Views system, content providers, resources
managers such as
• Activity Manager, manages the lifecycle of applications
and provides a common navigation backstack
• Notification Manager, enables all applications to
display custom alerts in the status bar
• Resource Manager, providing access to non-code
resources such as localized strings, graphics, and layout
files
• Views, used to build an application, including lists, grids,
text boxes, buttons, and even an embeddable web
browser
9. Applications Layer
• A set of core applications shipped with Android platform
– an email client, SMS program, calendar, maps,
browser, contacts, and others
• All written in Java
• User applications are also here
10. Features of Android
• Popularity (High market share)
• AWAT
• Enabled SMS
• Enabled GPS
• Cameras & microphones
• Open source apps
• Development with Java
• Linux based
• Short learning curve with IDE Java Eclipse IDE for
Android app development
• Easy deployment to mobile device
• Easy to distribute apps via Android Market
Share app, Sell app,
Download & reuse open source apps
11. Cont.
• Hot job market
– Market for mobile software surges from $4.1
billion in 2009 to $17.5 billion by 2012
– 2010 Dice.com survey: 60% for Android
– Dice.com: mobile app developers made
$85,000 in 2010 and salaries expected to
rise2
13. Origin of android
Android was founded in Palo Alto, California in
October 2003 by
Andy Rubin, Rich Miner,
Nick Sears and Chris White who work at “
” to develop.
Andy Rubin
14. …Origin of android
Android was purchased by the
in AUGUST, 2005 for 50 million $.
HTC Dream was the first android device
launched in September 2008
Now, android covers 90% of the mobile OS
market.
15. Open Handset Alliance (OHA)
It’s consortium of several companies.
OHA is a business alliance of firm to develop open
standard for mobile device.
OHA includes 84 firms to develop open standard for
mobile devices, i.e.
HTC, Sony, Dell, Intel, Motorola, QUALCOMM, Google
, Samsung Electronics, LG Electronics,T-Mobile, NVidias
Reason for Nokia not to developAndroid Mobiles
is Nokia is not part of OHA
16. • Categories of Android applications
History of Android
•The code names of android ranges from A to L currently, such as Aestro, Blender, etc…
Introduction to Android
17. Features
Android supports wireless communication using:-
3G Networks, 4G Networks, 802.11Wi-Fi Networks,
Bluetooth Connectivity
Developing an android application is not tough
,using SDK and java emulator we can easily develop
applications that we want.
Open source – Free development platform
Built in services like GPS,SQL Database, browser
and maps
Portability across current and future hardware
18. android Versions
Android Astro 1.0
• Released on September 23, 2008.
Android Cupcake 1.5
• Released on April 30, 2009.
Android Donut 1.6
• Released on September 15, 2009.
Android Éclair 2.0/2.1
• Released on October 26, 2009.
Android Froyo 2.2
• Released on May 20, 2010.
Android Gingerbread 2.3
• Released on December 6, 2010
Android Honeycomb 3.0
• Released on February 22, 2011.
Android IceCream Sandwich 4.0
• Released on November 14, 2011
Android JellyBean 4.1
• Released on June 27,2012
Android Kitkat 4.4
• Released on October 31,2013
19. android Versions
Android Lollipop 5.0
• Released on November 12, 2014
Android Marshmallow 6.0
• Released on May 28, 2015
Android Nougat 7.0
• Released on August 22, 2016
Android Oreo 8.0
• Released on August 21, 2017
• Latest version till date.
22. Android Runtime
Android includes a set of core libraries that provides most
of the functionality available in the core libraries of the Java
programming language.
DalvikVM.
• Dex files
• Compact and efficient than class files
• Limited memory and battery power
Core Libraries
• Java 5 Std edition
• Collections, I/O etc…
• Providing most of the functionality available in the
core libraries of the Java language.
Core Libraries
Dalvik Virtual
Machine
23. Libraries
Android includes a set of:
C/C++ libraries
Interface through Java
Surface manager – Handling UI Windows with 2D and
3D graphics
Media codes, SQLite, Browser engine
The Android Studio 3.1 supports new set of library :
24. Application Framework
The application architecture is designed to simplify the reuse
of components
Activity manager – manages application life cycle
Android provides a set of core applications:
Email Client
SMS Program
Calendar
Maps
Browser
Contacts, Etc.
All applications are written using the Java language.
APIs: Data Structures, Utilities, File Access, Network Access,
Graphics, etc.
28. Activity
• Activities provide a user interface for one
specific task, Basic component of most
applications
• Most applications have several activities
that start each other as needed
• Each is implemented as a subclass of the
base Activity class
29. Service
• Services execute background processing, no
visual interface
Ex: Downloads, Playing Music, TCP/UDP Server
• You can bind to an existing service, control its
operation, and run in background
• Play music, alarm clock, etc.
• Secured if using permissions
• Callers may need to verify that service is the
correct one
30. Content provider
• Content providers are data storage facilities
which supports data exchange between
applications
• Make data available to other applications
• Transfer data between applications in Android
• Other applications use a ContentResolver
object to access the data provided via a
ContentProvider
31. ContentProviders
• Generally SQL backend
• Used to share content between apps
• Access controlled through permission tags
• Apps can be dynamically authorized access
control
– Possible security hole
• Must protect against SQL injection
– verify input using parameterization
32. Broadcast receivers
• Broadcast receivers act as mailboxes for
messages from other applications. It receives
and reacts to broadcast announcements
• If an app registered the receiver in adv., the
event will notify and call back the registered
software
• Ex: Low battery, power connected, shutdown,
timezone changed, etc.
33. Broadcast receivers
• Act as receivers for multiple components
• Provide secure IPC
• Done by specifying permissions on
BroadcastReceiver regarding sender
• Otherwise, behave like activities in terms of IPC
– Can’t define permission
• Don’t send sensitive data
34. Component life cycle
• Activities
– Can terminate itself via finish();
– Can terminate other activities it started via
finishActivity();
• Services
– Can terminate via stopSelf(); or
Context.stopService();
• Content Providers
– Are only active when responding to ContentResolvers
• Broadcast Receivers
– Are only active when responding to broadcasts
35. Intent
– Intent is a goal action component which takes care of
the process of inter-components communication (ICC)
– Intent is simply a message object containing a
destination component address and data
– Protection
– Each application executes as its own user identity,
such that OS provides system-level isolation;
– Android middleware contains a reference monitor that
mediates the inter-component communication (ICC).
36. Intent(cont.)
Intent action:
– Start an Activity
– Broadcast events or changes
– Start, stop, resume. or communicate with
background Services
– Access data held by ContentProviders
– Call back to handle events
– Carry data with Extras (key, value)
37. Intent Filters
• Used to determine recipient of Intent
• Specify the main entrance for activities
• A user interface consists of a series of
Activities
• Each Activity is a “screen”.
• Intent may leave a security flaw (hole)
–Solution: Intents explicitly define
receiver
38. @2011 Mihail L. Sichitiu 38
Goal
• Understand applications and their
components
• Concepts:
– activity,
– service,
– broadcast receiver,
– content provider,
– intent,
– AndroidManifest
39. @2011 Mihail L. Sichitiu 39
Applications
• Written in Java (it’s possible to write native
code – will not cover that here)
• Good separation (and corresponding
security) from other applications:
– Each application runs in its own process
– Each process has its own separate VM
– Each application is assigned a unique Linux
user ID – by default files of that application
are only visible to that application (can be
explicitly exported)
40. 40
Application Components
• Activities – visual user interface focused
on a single thing a user can do
• Services – no visual interface – they run in
the background
• Broadcast Receivers – receive and react
to broadcast announcements
• Content Providers – allow data exchange
between applications
41. 41
Activities
• Basic component of most applications
• Most applications have several activities
that start each other as needed
• Each is implemented as a subclass of the
base Activity class
42. 42
Activities – The View
• Each activity has a default window to draw
in (although it may prompt for dialogs or
notifications)
• The content of the window is a view or a
group of views (derived from View or
ViewGroup)
• Example of views: buttons, text fields,
scroll bars, menu items, check boxes, etc.
• View(Group) made visible via
Activity.setContentView() method.
43. 43
Services
• Does not have a visual interface
• Runs in the background indefinitely
• Examples
– Network Downloads
– Playing Music
– TCP/UDP Server
• You can bind to a an existing service and
control its operation
44. 44
Broadcast Receivers
• Receive and react to broadcast
announcements
• Extend the class BroadcastReceiver
• Examples of broadcasts:
– Low battery, power connected, shutdown,
timezone changed, etc.
– Other applications can initiate broadcasts
45. 45
Content Providers
• Makes some of the application data
available to other applications
• It’s the only way to transfer data between
applications in Android (no shared files,
shared memory, pipes, etc.)
• Extends the class ContentProvider;
• Other applications use a ContentResolver
object to access the data provided via a
ContentProvider
46. 46
Intents
• An intent is an Intent object with a message content.
• Activities, services and broadcast receivers are started
by intents. ContentProviders are started by
ContentResolvers:
– An activity is started by Context.startActivity(Intent intent) or
Activity.startActivityForResult(Intent intent, int RequestCode)
– A service is started by Context.startService(Intent service)
– An application can initiate a broadcast by using an Intent in any
of Context.sendBroadcast(Intent intent),
Context.sendOrderedBroadcast(), and
Context.sendStickyBroadcast()
47. 47
Shutting down components
• Activities
– Can terminate itself via finish();
– Can terminate other activities it started via finishActivity();
• Services
– Can terminate via stopSelf(); or Context.stopService();
• Content Providers
– Are only active when responding to ContentResolvers
• Broadcast Receivers
– Are only active when responding to broadcasts
48. 48
Android Manifest
• Its main purpose in life is to declare the
components to the system:
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity
android:name="com.example.project.FreneticActiv
ity"
android:icon="@drawable/small_pic.pn
g"
android:label="@string/freneticLabel"
. . . >
</activity>
. . .
</application>
</manifest>
49. 49
Intent Filters
• Declare Intents handled by the current application (in the
AndroidManifest):
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity android:name="com.example.project.FreneticActivity"
android:icon="@drawable/small_pic.png"
android:label="@string/freneticLabel"
. . . >
<intent-filter . . . >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter . . . >
<action android:name="com.example.project.BOUNCE" />
<data android:mimeType="image/jpeg" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
. . .
</application>
</manifest>
Shows in the
Launcher and
is the main
activity to
start
Handles JPEG
images in
some way
50. Conclusion
Android is a truly open, free development
platform based on Linux and open source.
Handset makers can use and customize the
platform without paying a royalty.
Android is now stepping up in next level of
mobile internet.
Android is open to all: industry, developers and
users
Google Android is stepping into the next level
of Mobile Internet & that is the reason that
android covers 90% of mobile OS market
51. • OS
• Android application development on either of the following operating
systems:
– Microsoft Windows.
– Mac OS X 10.5.8 or later version with Intel chip.
– Linux including GNU C Library 2.7 or later.
• Tools
• All the required tools to develop Android applications are freely
available and can be downloaded from the Web. Following is the list
of software's you will need before you start your Android application
programming.
1. Java JDK5 or later version
2. Android Studio / Android SDK and Eclipse IDE for Java Developers
(optional) and Android Development Tools (ADT) Eclipse Plug-in
(optional)
Requirements for Android
52. • Download Android Studio
• From http://developer.android.com/sdk/installing/index.html
• System Requirements for Windows
• Microsoft® Windows® 8/7/Vista (32 or 64-bit)
• 2 GB RAM minimum, 4 GB RAM recommended
• 400 MB hard disk space
• At least 1 GB for Android SDK, emulator system images, and caches
• 1280 x 800 minimum screen resolution
• Java Development Kit (JDK) 7
• Optional for accelerated emulator: Intel® processor with support for
Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit
functionality
Requirements for Android
53. • Java
1. Visit http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. Install it.
• Android Studio
3. Visit http://developer.android.com/sdk/index.html
4. click the button Download Android Studio.
5. Accept terms, and click Download.
6. Run executable file of setup.
7. Follow the setup wizard to install Android Studio and any necessary SDK tools.
8. On some Windows systems, the launcher script does not find where Java is installed.
If you encounter this problem, you need to set an environment variable indicating the
correct location.
9. Select Start menu > Computer > System Properties > Advanced System Properties.
Then open Advanced tab > Environment Variables and add a new system variable
JAVA_HOME that points to your JDK folder, for example C:Program
FilesJavajdk1.7.0_45
Installation
54. 10.The individual tools and other SDK packages are saved outside the
Android Studio application directory. If you need to access the tools
directly, use a terminal to navigate to the location where they are
installed. For example:
11.Users<user>sdk
12.Android Studio is now ready and loaded with the Android developer
tools, but there are still a couple packages you should add to make
your Android SDK complete.
• Run
1. Run Android Studio as Administrator.
2. Before you create new project, click Configure from splash screen.
Click SDK Manager.
3. Don’t select all. In bottom, in Extra section, select Intel x86 Emulator
Accelerator.
4. Click Install button.
Installation
55. • The Android SDK includes a mobile device
emulator — a virtual mobile device that runs on
your computer. The emulator lets you develop
and test Android applications without using a
physical device.
• Limitations
• No support for placing or receiving actual
phone calls. You can simulate phone calls
(placed and received) through the emulator
console, however.
Android Emulator
• The AVD android virtual device Manager provides a graphical user interface in which you can create and
manage Android Virtual Devices (AVDs), which are required by the Android Emulator.
Android Studio
• Tools > Android > AVD Manager
AVD Manager
56. • Genymotion
• It is a fast third party Android emulator for app testing and
presentation on Windows that can be used instead of the default
Android emulator. In some cases it's as good as or better than
developing on actual devices!
1. Visit https://www.genymotion.com
2. Click Free version. Click Get Genymotion.
3. Create a Genymotion account, sign in.
4. Download and install Genymotion.
• Run Genymotion
1. First time you have to sign in with your credentials. It will connect with
cloud and provide available virtual devices.
2. Add your desired virtual device.
Optional Installation - Genymotion