2. What is Android?
Android is an open source and Linux-based operating system for mobile
devices such as smartphones and tablet computers. Android was developed by
the Open Handset Alliance, led by Google, and other companies.
It is not just another operating system for high-end mobile phones….
It is a software platform, rather than just an OS, that has the potential to be
utilized in a much wider range of devices.
Android is an application framework on top of Linux, which facilitates its
rapid deployment in many domains.
3. History
October 2003 - Android Inc. founded by Andy Rubin, Rich Miner, Nick Sears and
Chris White
August 2005 - Google acquired Android Inc.
November 2007 - Open Handset Alliance (OHA) formed
September 2008 - Android 1.0 released
April 2009 – Android 1.5 (Cup Cake)
October 2006 - Android 2.0 (Eclair)
May 2010 – Android 2.2 (Froyo)
Dec 2010 – Android 2.3 (Gingerbread)
Feb 2011 – Android 3.0 (HoneyComb)
October 2011 – Android 4.0 (Ice Cream Sandwich)
July 2012 – Android 4.1, 4.2 (Jelly Bean) to date
5. Features
Application framework - enabling reuse and replacement of components
Dalvik virtual machine - optimized for mobile devices
Integrated browser - based on the open source WebKit engine
Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the
OpenGL ES 1.0 specification (hardware acceleration optional)
SQLite for structured data storage
Media support for common audio, video, and still image formats
(MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)
GSM Telephony (hardware dependent)
Bluetooth, EDGE, 3G, and WiFi (hardware dependent)
Camera, GPS, compass, and accelerometer (hardware dependent)
Rich development environment including a device emulator, tools for debugging, memory
and performance profiling, and a plugin for the Eclipse IDE
6. Dalvik Virtual Machine
This is not strictly a Java virtual machine.
It was designed specifically for Android and is optimized in two key ways.
Designed to be instantiated multiple times – each application has its own private
copy running in a Linux process.
Also designed to be very memory efficient, being register based (instead of being
stack based like most Java VMs) and using its own bytecode implementation.
The Dalvik VM makes full use of Linux for memory management and multi-
threading, which is intrinsic in the Java language.
Android applications are commonly implemented in Java utilizing the Dalvik
VM.
Accommodates interoperability which results in application portability, e.g.
the message sending capability of the SMS application can be used by another
application to send text messages.
7. Android distribution channels…
The main distribution channel is Google Play (previously called Android
Market),
App Geyser - Alternative free distribution channel
Lots of other third party sites that offer direct download of the android APK.
Apktop.com
8. Development Environment
Full Java IDEs - Eclipse, IntelliJ, Netbeans and recently Android Studio
Plugins and a download of the Google Android SDK are required for all the
above IDEs except for Android Studio which comes in-built.
Graphical UI Builders - IDEs also provide GUI Builder for drag and drop
functionality
Develop on Virtual Devices - You can specify your target configuration by
specifying an Android Virtual Device (AVD) during development
Develop on Hardware Devices – Execute code on either the host-based
emulator or a real device, which is normally connected via USB.
Powerful Debugging - Full Java debugger with on-device debugging and
Android-specific tools.
9. Programming Model
An Android application consists of a number of resources which are bundled
into an archive – an Android package.
Programs are generally written in Java, built using the standard Java
tools, and then the output file is processed to generate specific code for the
Dalvik VM.
An application is a set of components which are instantiated and run as
required. There is not really an entry point or main() function.
There are four types of application component: activities, services, broadcast
receivers, and content providers
10. An Activity…
A functional unit of the application, which may be invoked by another
activity.
It has a user interface of some form.
An application may incorporate a number of activities.
One activity may be nominated as the default which means that it may be
directly executed by the user.
11. A Service…
Similar to an activity, except that it runs in the background
Runs without a UI.
An example of a service might be a media player that plays music while the
user performs other tasks.
12. Broadcast Receivers…
Responds to a broadcast messages from other applications or from the
system.
For example, it may be useful for the application to know when a picture has
been taken. This is the kind of event that may result in a broadcast message.
13. Content Provider
Supplies data from one application to others on request.
Requests are handled by the methods of the ContentResolver class.
The data may be stored in the file system, the database or somewhere else
entirely.
15. Application Lifecycle details…
Resumed – The activity is in the foreground and the user can interact with it.
(Also sometimes referred to as the "running" state.)
Paused – The activity is partially obscured by another activity—the other
activity that's in the foreground is semi-transparent or doesn't cover the
entire screen. It does not receive user input and cannot execute any code.
Stopped - The activity is completely hidden and not visible to the user; it is
considered to be in the background. While stopped, the activity instance and
all its state information such as member variables is retained, but it cannot
execute any code.
The other states (Created and Started) are transient and the system quickly
moves from them to the next state by calling the next lifecycle callback
method. That is, after the system calls onCreate(), it quickly calls
onStart(), which is quickly followed by onResume().
17. Physical Project Structure in Eclipse…
/SRC
The src folder contains the Java source code files of your application organized
into packages
/GEN
Automatically generated files by the ADT. Here the R.java file contains
reference/index to all the resources in the res we use in our program.
/ASSETS
The assets folder is used to store raw asset files. You can keep any raw data in the
assets folder and there’s an asset manager in Android to read the data stored in
the folder. The raw data can be anything such as audio, video, images etc.
18. Physical Project Structure in Eclipse…
/BIN
/bin folder is where our compiled application files go. When we successfully
compile an application, this folder will contain java class files, dex files which are
executable under Dalvik virtual machine, apk archives etc.
/RES
/res folder is where we store all our external resources for our applications such as
images, layout XML files, strings, animations, audio files etc.
/res/drawable - This folder contains the bitmap file to be used in the program
/res/layout - XML files that defines the User Interface goes in this folder.
/res/values - XML files that define simple values such as
strings, arrays, integers, dimensions, colors, styles etc. are placed in this folder.
/res/menu - XML files that define menus in your application goes in this folder
19. AndroidManifest.xml
One of the most important file in the Android project structure. It contains all
the information about your application.
When an application is launched, the first file the system seeks is the
AndroidManifest.xml file. It actually works as a road map of your
application, for the system
The Android Manifest file contains information about:
Components of your application such as Activities, services etc.
User permissions required
Minimum level of Android API required