You are on page 1of 65

Introduction to Android

MOBILE O.S
Some of the popular operating systems used in mobile gadgets are given below. 1. Symbian Nokia Windows Phone 2. iOS 3. Blackberry O.S 4. Android manufacturers Apple Blackberry Many Handset

WHAT IS ANDROID?

Android is a software stack for mobile devices that includes an operating system, middleware and key applications

GOOGLE

We want the next killer application to be written for cell phones

- Andy Rubin, Google

GOOGLE ANDROID

BUYS

OPEN HANDSET ALLIANCE

OPEN HANDSET ALLIANCEseveral companies It's a consortium of

Devoted to advancing open standards for mobile devices Develop technologies that will significantly lower the cost of developing and distributing mobile devices and services

ANDROID SDK

T-MOBILE G1

September 2008

Retail launch

October 22, 2008

G1 TECHNICAL SPECS ROM 256 MB


RAM 192 MB 4.60 in x 2.16 in x 0.62 in 158 grams 3G (HSDPA)

Touch screen, HVGA 320x480 3.2 megapixel camera

Micro-SD expansion slot


GPS, compass, accelerometer

THIRD PARTY APPLICATIONS

ANDROID APPLICATIONS

Multiple applications, running simultaneously User may switch between running applications Background services Supports three Orientations

Has access to wi-fi, phone state, audio settings, external memory access.

GOOGLES MASTER PLAN

Make the cloud more Accessible Keep connectivity Pervasive

Make the client more Powerful

GOOGLES MASTER PLAN

DISTRIBUTING ANDROID APPS

Android Market Self-publish on your own web site

Use a 3rd party application store

ANDROID MARKET

ANDROID MARKET

$25 registration fee for developers


developer receives 70% of each sale remaining amount goes to carriers Google does not take a percentage http://www.android.com/market/

MARKET GOT YOU DOWN?

Market got you down? upload APK to your own web server

http://icecondor.com/download/icecondor-2008-1026.apk
use correct MIME type application/vnd.android.package-archive

IPHONE VS ANDROID !?

6) COST

STATISTICS

STATISTICS

Extras
<------Android enabled Car Stereo

ANDROID ENABLED FRIDGE ------------> ANDROID ENABLED WATCH

SYSTEM ARCHITECTURE

LINUX KERNEL

Android relies on Linux version 2.6 for core system services, acts as a layer between hardware and software.

Manages the following; Security Memory management Process management Network stack Driver model

DALVIK VM

Not a Java VM Design constraints: slow CPU, little RAM

Will run on OS without swap space


On compiling .class files will be changed to .dex format The .dex format runs on the Dalvik platform.

LIBRARIES libraries used by various components of the A set of C/C++


Android system.
Some of the core libraries are listed below: System C library - an implementation of the standard C system library (libc), tuned for embedded Linux-based devices Media Libraries - the libraries support playback and recording of many popular audio, video and image formats . Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view SGL - the underlying 2D graphics engine FreeType - bitmap and vector font rendering SQLite - a powerful and lightweight relational database engine available to all applications

APPLICATION FRAMEWORK
Activity Manager : Maintains the activities/screens of the applications that are displayed Window Manager: Co-ordinates the orientation of phone, sensors etc. Content : Manages the data to be transferred between Activities / screens : Controls the various layouts, button and UI level objects : Deals with the display of AlertBox, Toast msgs.

Manager
View System Notification Manager Telephony Manager Location Manager

Handles the process like call, sms, mms etc.

: Uses Google Maps to access location related info

NETWORK CONNECTIVITY
It supports wireless communications using GSM mobile-phone technology

3G
802.11 Wi-Fi networks Integrated Browser

APPLICATION APIS
UI

Telephony android.widget.* android.telephony.TelephonyManager android.telephony.SmsManager android.view.* android.graphics.* android.app.Activity etc

PhoneState android.content.res.Configurati on android.hardware.Sensor android.net.wifi.WifiManager

APPLICATION APIS
Web android.webkit.WebView Camera android.hardware.CameraDevice Local database android.database.* Maps com.google.android.maps.MapView Location android.location.LocationManager Multimedia android.media.MediaPlayer

API LEVELS

API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform:
Android 2.3 (Gingerbread) 9/10 8 7

Android 2.2 (Froyo)


Android 2.0/2.1 (Eclair) Android 1.6 (Donut) Android 1.5 (Cupcake)

4
3

DEVELOPMENT TOOLS

Android SDK Eclipse plugin Android emulator Command line tools Documentation Debugging tools Android NDK Android PDK

ANDROID SOFTWARE DEVELOPMENT


Essential for the development of applications on android environment.

Consists of the emulator, documentation, debugging tools and command line Also requires ADT plugin for merging with eclipse. Steps you must follow to set up the Android SDK: Prepare your development computer and ensure it meets the system requirements. Install the SDK starter package from the table above. (If you're on Windows, download the installer for help with the initial setup.) Install the ADT plugin for Eclipse (if you'll be developing in Eclipse). Add Android platforms and other components to your SDK. Installers available at :
http://developer.android.com/sdk/index.html,
http://developer.android.com/sdk/eclipseadt.html#installing

ANDROID NATIVE DEVELOPMENT


NDK is a companion tool to the Android SDK that lets you build performance-critical portions of your apps in native code. The NDK provides: A set of tools and build files used to generate native code libraries from C and C++ sources A way to embed the corresponding native libraries into application packages files (.apks) that can be deployed on Android devices A set of native system headers and libraries that will be supported in all future releases of the Android platform. Some of the needed Android source code packages available in http://android.git.kernel.org/ are: 1) Android.platform.bionic, 2) Android.platform.build, 3) Android.platform.system.core, and

ANDROID PLATFORM DEVELOPMENT


Designed for platform developers and manufacturers building Android-powered devices. Manages the porting of android operating system into a device that matches requirements Allows the developer to alter based on their device
Following are the main steps for porting Android: Download the patches for Android Update RIL (Radio Interface Library) for target platform Update Board specific components such as Codec, Camera, Audio, Wifi, Power Management, Bluetooth etc. Compile Android source code Burn system image on Target platform

ANDROID DEBUG BRIDGE


A versatile tool lets you manage the state of an emulator instance or Android-powered device. It is a client-server program that includes three components: A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device. A daemon, which runs as a background process on each emulator or device instance.

ADB COMMANDS
adb push <packagename.apk> /system/app/ ----------put in system folder adb devices ----lists which devices are currently attached to your computer adb install <packagename.apk> lets you install an Android application on your phone adb remount Remounts your system in write mode this lets you alter system files on your phone using ADB adb push <localfile> <location on your phone> lets you upload files to your phones filesystem adb pull <location on your phone> <localfile> lets you download files off your phones filesystem adb logcat starts dumping log from the console to a local file useful for debugging apps adb shell <command> drops you into a basic linux command shell on your phone with no parameters, or lets you run commands directly adb devices lists which devices are currently attached to your computer

ANDROID EMULATOR

EMULATOR LIMITATIONS

No support for placing or receiving actual phone calls No support for camera/video capture (input) No support for determining battery charge level Emulator limitations No support for Bluetooth

DEBUGGING TOOLS
Android Debug Bridge A versatile tool lets you manage the state of an emulator instance or Android-powered device. android Lets you manage AVDs, projects, and the installed components of the SDK. dmtracedump Generates graphical call-stack diagrams from trace log files. The tool uses the Graphviz Dot utility to create the graphical output, so you need to install Graphviz before running dmtracedump. For more information on using dmtracedump. layoutopt Lets you quickly analyze your application's layouts in order to optimize them for efficiency.

DEBUGGING TOOLS
logcat Lets you read system log messages that are output on an Android device or emulator. mksdcard Helps you create a disk image that you can use with the emulator, to simulate the presence of an external storage card (such as an SD card). Monkey Runs on your emulator or device and generates pseudorandom streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner. sqlite3 Lets you access the SQLite data files created and used by Android applications.

COMPONENT MODEL
While each application runs as its own UNIX uid, sharing can occur through application-level interactions Interactions based on components Different component types : Activity Service Content Provider Broadcast Receiver

ACTIVITY

Each Activity is a screen. User actions tell an Activity to start another Activity, possibly with the expectation of a result. The target Activity is not necessarily in the same application. Processing stops when another Activity is on top. However, activities can also be faceless One activity is designated as the entry point for your application Building block of an activity is View

ACTIVITY LIFE CYCLE

SERVICE COMPONENT
Background processing occurs in Service components.

Downloading a file, playing music, tracking location, polling, etc. Local vs. Remote Services (process-level distinction)

Also provides a service interface between applications


Android Interface Definition Language (AIDL) Register callback methods Core functionality often implemented as Service components e.g., Location API, Alarm service

CONTENT PROVIDER COMPONENT


Content Provider components provide a standardized interface for sharing data, i.e., content (between applications). Models content in a relational DB

Users of Content Providers can perform queries equivalent to SELECT, UPDATE, INSERT, DELETE
Works well when content is tabular Also works as means of addressing files

BROADCAST RECEIVER COMPONENT


Broadcast Receiver components act as specialized event Intent handlers (also think of as a message mailbox). Broadcast Receiver components subscribe to specific action strings (possibly multiple) action strings are defined by the system or developer component is automatically called by the system Recall that Android provides automatic Activity resolution using action strings. The action string was assigned to an Intent object Sender can specify component recipient (no action string)

ANDROID MANIFEST
Manifest files are the technique for describing the contents of an application package (i.e., resource file) Each Android application has a special AndroidManifest.xml file (included in the .apk package) describes the contained components components cannot execute unless they are listed specifies rules for auto-resolution specifies access rules describes runtime dependencies optional runtime libraries required system permissions

ANDROID MANIFEST

EXAMPLE APPLICATIONS

APK & PROJECT STRUCTURE


An .apk file extension denotes an Android Package (APK) file. A variant of the JAR format, is used for the distribution and installation of bundled components onto the Android mobile device platform.

An APK file is an archive that usually contains the following folders: META-INF res and files: AndroidManifest.xml classes.dex resources.arsc

IMPLEMENTING APPLICATION UI

Java code Dynamic creation of UI


e.g:

AlertDialog.Builder alt_bld = new AlertDialog.Builder(this); ImageButton imgBtn = new ImageButton(this); LinearLayout holder = new LinearLayout(this); holder.addView(imgBtn);
alt_bld.setView(holder); alt_bld.show()

XML
UI creation before the creation of apk

ANDROID UI: XML

ANDROID UI: VIEWS

An object that knows how to draw itself on the screen Examples; android.widget.ListView android.widget.DatePicker android.widget.Button android.widget.ImageView android.view.LinearLayout

Lets say Bye for now World!!

Thank You

The End

You might also like