19
By Vishwesh Jirgale Persistent Systems Ltd. Manager – Pune Google Technology Users Group

Introduction to Android

Embed Size (px)

Citation preview

Page 1: Introduction to Android

By Vishwesh JirgalePersistent Systems Ltd.

Manager – Pune Google Technology Users Group

Page 2: Introduction to Android

What’s so special about Android ?

• How Android is different to other Platforms including Windows Mobile, Symbian/S60/UIQ, and proprietary (Nucleus, EMP, BREW, etc):o Java as programming language, and not restricting to Java ME, so giving a broader set of libraries

for developers. Much like SavaJe (now Sun’s Java FX Mobile), Android is a Java SE -like  platform built on a Linux kernel, but more importantly one where the Java platform is deeply integrated with the underlying Linux support package

o Funny thing - Google doesn’t claim that Android is a Java platform, although it can run some programs written with the Java language and against some derived version of the Java class library. Because they use Dalvik, a ‘proprietary’ (non-Sun-endorsed) Java virtual machine which means that Android developers can use Java SE APIs, while Google does not have to pay any royalties to Sun for TCK certification

o The declarative XML UI framework enables developers and handset manufacturers to rapidly develop the user interface for new applications.

o The Android SDK is an environment for building connected applications. Every application (including dialler, idle screen, SMS, contacts, etc) can consume and produce content. Every application on Android is a Web 2.0 citizen.

o The Android source code will be licensed under the Apache 2.0 license, a non-copyleft license which allows handset manufacturers to modify the source code without being forced to share back their modifications. 

Page 3: Introduction to Android

Aah… You are a developer first !!!

A developer's perspective on Google's Android

Page 4: Introduction to Android

What Is Android?

• Android is a complete software stack for mobile devices such as cell phones, PDAs and high end MP3 players. The software stack is split into four layers: o The application layero The application frameworko The libraries and runtimeo The kernel

• Cell phone users obviously work with applications in the application layer. Android developers write those applications using the application framework.

• Interesting - Unlike many embedded operating environments, Android applications are all equal -- that is, the applications that come with the phone are no different than those that any developer writes.

Page 5: Introduction to Android

Android Architecture

Page 6: Introduction to Android

Android Architecture

• Applicationso Android will ship with a set of core applications including an email client, SMS

program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language.

• Application Frameworko Developers have full access to the same framework APIs used by the

core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.

• Librarieso Android includes a set of C/C++ libraries used by various components of the

Android system. These capabilities are exposed to developers through the Android application framework.

• Android Runtimeo Android includes a set of core libraries that provides most of the functionality

available in the core libraries of the Java programming language.

• Linux Kernelo Android relies on Linux version 2.6 for core system services such as security,

memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.

Page 7: Introduction to Android

Android’s features

• 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

Page 8: Introduction to Android

For developers – What all I need ?

• Supported Operating Systemso Windows XP or Vista o Mac OS X 10.4.8 or later (x86 only) o Linux (tested on Linux Ubuntu Dapper Drake)

• Other than Android SDK you will need -o Eclipse IDE

Eclipse 3.2, 3.3 (Europa) Eclipse JDT plugin (included in most Eclipse IDE packages) WST (optional, included in most Eclipse IDE packages)

o JDK 5 or JDK 6 (JRE alone is not sufficient) o Not compatible with Gnu Compiler for Java (gcj) o Android Development Tools plugin (optional)

Page 9: Introduction to Android

What's inside SDK ?

Page 10: Introduction to Android

What's inside SDK ?

• android.jar - The Android application framework. Unzipping this jar reveals the entire class structure and all of the supporting classes of the framework. Currently there is no source.

• docs - 100 megabytes worth of documentation, samples, etc.

• samples - Six different sample applications - ApiDemos, HelloActivity, LunarLander, NotePad, SkeletonApp and Snake

• tools - the various SDK binaries such as aapt, acp, and emulator live here.o lib - various templates and supporting jar files live in this directory

activityCreator - the activityCreator python application lives here. images - The Linux file system images are found in this directory:

ramdis.img, system.img and userdata.img. They are YAFFS2 file system images.

skins - supporting emulator graphics for HVGA and QVGA screens in both landscape and portrait format.

Page 11: Introduction to Android

Write My First Android App – How about “Hello Android”

• Ok show me -

Page 12: Introduction to Android

Application Building Blocks

• AndroidManifest.xmlo The AndroidManifest.xml file is the control file that tells the system what to do with all the top-level

components (specifically activities, services, intent receivers, and content providers described below) you've created. For instance, this is the "glue" that actually specifies which Intents your Activities receive.

• Activitieso An Activity is, fundamentally, an object that has a life cycle. An Activity is a chunk of code that

does some work; if necessary, that work can include displaying a UI to the user. It doesn't have to, though - some Activities never display UIs. Typically, you'll designate one of your application's Activities as the entry point to your application.

• Viewso A View is an object that knows how to draw itself to the screen. Android user interfaces are

comprised of trees of Views. If you want to perform some custom graphical technique (as you might if you're writing a game, or building some unusual new user interface widget) then you'd create a View.

• Intentso An Intent is a simple message object that represents an "intention" to do something. For example,

if your application wants to display a web page, it expresses its "Intent" to view the URI by creating an Intent instance and handing it off to the system. The system locates some other piece of code (in this case, the Browser) that knows how to handle that Intent, and runs it. Intents can also be used to broadcast interesting events (such as a notification) system-wide.

Page 13: Introduction to Android

Application Building Blocks

• Serviceso A Service is a body of code that runs in the background. It can run in its own process, or in the

context of another application's process, depending on its needs. Other components "bind" to a Service and invoke methods on it via remote procedure calls. An example of a Service is a media player; even when the user quits the media-selection UI, she probably still intends for her music to keep playing. A Service keeps the music going even when the UI has completed.

• Notificationso A Notification is a small icon that appears in the status bar. Users can interact with this icon to

receive information. The most well-known notifications are SMS messages, call history, and voicemail, but applications can create their own. Notifications are the strongly-preferred mechanism for alerting the user of something that needs their attention.

• ContentProviderso A ContentProvider is a data storehouse that provides access to data on the device; the classic

example is the ContentProvider that's used to access the user's list of contacts. Your application can access data that other applications have exposed via a ContentProvider, and you can also define your own ContentProviders to expose data of your own.

Page 14: Introduction to Android

Applications already available

• Maps Applicationso Driving Directionso Friend Locatoro Hotel Locator

• System Applicationso Task Managero File Browserso SD Card emulatorso Bluetooth emulationo Remote Camera Streamingo Telnet Client

• Web Applicationso Android Weather Forceaster which uses Google Weather APIo XML RPC Client for Android

• Other o Android Dictionary (Eng <-> Chinese)o Caltrain Schedule

• UI Designero Droid draw

Page 15: Introduction to Android

Hummer Phone

Page 16: Introduction to Android

Levi’s Phone

Page 17: Introduction to Android

References and further reading

• http://code.google.com/android• http://www.anddev.org• Multiple blog sites

• Further Reading• http://code.google.com/android/toolbox/• Test Driven Development and GUI Testing on the Android

platform: http://dtmilano.blogspot.com/2008/01/test-driven-development-and-gui-testing.html

Page 18: Introduction to Android

News

• Texas Instrument demonstrated its Android Mobile platform at Mobile World Congress in Barcelona. Its on TI’s OMAP 850 processor

• It has WiFi, Bluetooth wireless, Web Browsing, send emails, check your gmail account and of course make and receive calls.

• Some Pics -

Page 19: Introduction to Android

Thank YouQuestions?

You can reach me [email protected]