2. 2
2. Platform
• Hardware
• Operating System (Android) Architecture
• File System
• Database Support
• Network Connectivity
• Security and Permissions
• Programming Languages support
• Development requirements
3. 3
2.1 Hardware
• Android is not a single piece of hardware; it's a complete, end-to-end
software platform that can be adapted to work on any number of
hardware configurations. Everything is there, from the boot loader to all
the way up to the applications.
5. 2.2.1 Linux Kernel
• Android runs on Linux (version 2.6).
• Linux provides :
– Hardware abstraction layer
– Memory management
– Process management
– Networking
• Users never see Linux sub system
• The adb shell command opens Linux shell
5
6. 2.2.2 Libraries
• Bionic, a super fast and small GPL-based standard C system library (libc)
optimized for embedded Linux-based devices
• Surface Manager for composing window manager with off-screen buffering 2D
and 3D graphics hardware support or software simulation
• Media codecs offer support for major audio/video codecs
• SQLite database
• WebKit library for fast HTML rendering
6
7. 2.2.3 Android Runtime
Dalvik :
• Dalvik VM is Google’s implementation of Java
• Optimized for mobile devices
• Key Dalvik differences:
– Register-based versus stack-based VM
– Dalvik runs .dex files
– More efficient and compact implementation
– Different set of Java libraries than SDK
7
8. 2.2.4 Application Framework
• Activity manager controls the life cycle of the app
• Content providers encapsulate data that is shared (e.g. contacts)
• Resource manager manages everything that is not the code
• Location manager figures out the location of the phone (GPS, GSM, WiFi)
• Notification manager keeps track of events such as arriving
messages, appointments etc.
8
9. 2. 3 File System
• The file system has three main mount points.
– One for system,
– one for the apps,
– and one for whatever.
•Each app has its own sandbox easily accessible to it.
No one else can access its data. The sandbox is in
/data/data/package_name/
•SDCard is always there. It’s a good place for
large files, such as movies and music.
Everyone can access it.
9
10. 10
2.4 Database Support
• The Android API contains support for creating and using SQLite databases.
Each database is private to the application that creates it.
• Android ships with the sqlite3 database tool, which enables you to browse
table contents, run SQL commands, and perform other useful functions on
SQLite databases.
• All databases, SQLite and others, are stored on the device in
/data/data/package_name/databases.
11. 2.5 Network Connectivity
• Android supports wireless communications using:
– GSM mobile-phone technology
– 3G
– Edge
– 802.11 Wi-Fi networks
– BlueTooth
• HTTP : Android has org.apache.http package that has the core interfaces
and classes of the HTTP components.
• HTTPS & SSL: Android provides javax.net.ssl package that has all the
classes and interfaces needed to implement and program the Secure
Socket abstraction based on the SSL protocol SSSLv3.0 or TLSv1.2.
• XML : Most of Java's XML-related APIs are fully supported on Android.
Java's Simple API for XML (SAX) and the Document Object Model (DOM)
are both available on Android.
16
Ref: http://developer.android.com/reference/org/apache/http/package-summary.html
http://developer.android.com/reference/javax/net/ssl/package-summary.html
http://www.ibm.com/developerworks/opensource/library/x-android/index.html
12. 2.6 Security and Permissions (1)
Security Architecture:
• A central design point of the Android security architecture is that no
application, by default, has permission to perform any operations that
would adversely impact other applications, the operating system, or the
user.
• An application's process is a secure sandbox. It can't disrupt other
applications.
• The permissions required by an application are declared statically in that
application, so they can be known up-front at install time and will not
change after that.
17
Ref: http://developer.android.com/guide/topics/security/security.html
13. 13
2.6 Security and Permissions (2)
a. Process level security
b. User & File level security
c. Using Permissions
14. 2.6 Security and Permissions (3)
a. Process level security:
• Each Android application
runs inside its own Linux
process.
• Additionally, each application
has its own sandbox file
system with its own set of
preferences and its own
database.
• Other applications cannot
access any of its data,
unless it is explicitly shared.
14
15. 15
Ref: http://developer.android.com/guide/topics/security/security.html
2.6 Security and Permissions (4)
b. User and File level security :
• Each Android package (.apk) file installed on the device is given its own unique
Linux user ID, creating a sandbox for it and preventing it from touching other
applications (or other applications from touching it).
• This user ID is assigned to it when the application is installed on the
device, and remains constant for the duration of its life on that device.
• Security enforcement happens at the process level, the code of any two
packages can not normally run in the same process, since they need to run as
different Linux users.
• Any data stored by an application will be assigned to that application's user
ID, and not normally accessible to other packages.
• The file created by your application is owned by your application, but its global
read and/or write permissions have been set appropriately so any other
application can see it.
16. 16
Ref: http://developer.android.com/guide/topics/security/security.html
2.6 Security and Permissions (5)
c. Using Permissions:
• A basic Android application has no permissions associated with it.
• To make use of protected features of the device, you must include in your
AndroidManifest.xml one or more <uses-permission> tags declaring the
permissions that your application needs.
• For example, an application that needs to monitor incoming SMS
messages would specify:
• <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.app.myapp" >
<uses-permission android:name="android.permission.RECEIVE_SMS" />
</manifest>
19. 19
3. IDE and Tools
• Android SDK
• Eclipse IDE + Android Development Tools (ADT) plug in
• Other IDEs
• Tools for debugging, compiling and packaging
20. 3. 1 Android SDK
• Overview of how to get started with the Android SDK:
– make sure that development computer meets the hardware and software requirements
for the Android SDK.
– install the JDK (version 5 or 6 required) and Eclipse (version 3.4 or 3.5, needed only if
you want to develop using the ADT Plugin)
– Download and install the SDK starter package
– Install the Android Development Tool (ADT) Plugin for Eclipse
– Add Android platforms (Android 1.6 or Android 2.0) and other components to your SDK
25
Ref: http://developer.android.com/sdk/index.html
21. 21
3.2 Other IDEs
• Android Applications can be developed in other IDEs such as :
– IntelliJ
– a basic editor such as Emacs
• The recommended way to develop an Android application is to use Eclipse
with the ADT plugin. The ADT plugin provides
editing, building, debugging, and .apk packaging and signing functionality
integrated right into the IDE.
• When developing in IDEs or editors other than Eclipse, you'll require
familiarity with the following Android SDK tools:
– android To create/update Android projects and to create/move/delete AVDs.
– Android Emulator To run your Android applications on an emulated Android platform.
– Android Debug Bridge To interface with your emulator or connected device (install
apps, shell the device, issue commands, etc.).
22. 22
3.3 Other tools
Other Open source and third-party tools :
• Ant - To compile and build your Android project into an installable .apk
file.
• Keytool - To generate a keystore and private key, used to sign your .apk
file.
• Jarsigner (or similar signing tool) - To sign your .apk file with a private key
generated by keytool
– Note: The SDK includes all the tools you need to set up an Android project, build
it, debug it and then package it for distribution.
23. 23
4. Applications Development Walkthrough
• Developing Applications on an Emulator
• Singing your application
• Versioning your application
• Preparing to publish your application
• Publish your App on Android Market
• Sample Applications
24. 24
4.1 Developing Applications on an Emulator
1. Setting up Environment for Development
2. Create Android Virtual Device (AVD)
3. Creating and running a sample App Walkthrough
25. 4.2 Create Android Virtual Device(AVD)
• An AVD defines the system image and device settings used by the
emulator.
• Command : android create avd --target 2 --name my_avd
25
26. 4.3 Creating and running a sample App Walkthrough
32
http://developer.android.com/guide/tutorials/hello-world.html
27. 27
4.4 Publish your App on Android Market
• Android Market is a hosted service that makes it easy for
– Android Users to find and download Android applications
– Android Developers to publish their applications
• To publish your application on Android Market you:
– first need to register with the service using your Google account
– must agree to the terms of service
• To register as an Android Market developer visit
– http://market.android.com/publish
• Requirements enforced by the Android Market server:
– application must be signed with a cryptographic private key whose validity period ends
after 22 October 2033.
– Application must define version code, version name, icon and label attributes in
manifest