Sei sulla pagina 1di 44

Android 101

By Pranay Airan @pranayairan

Pranay Airan Web application developer @Intuit Android Developer by choice

Assistant organizer Blrdroid @pranayairan

Why Android
2 million
Android device activation per day

Why Android
750+ million
Android device activated till now

Why Android
70%
Android market share world wide

Android Architecture

Getting Started
IDE Eclipse

Folder Structure Setting your development environment Different tools available in eclipse

Android App Building Blocks

Activities
Intents

Views Services
Content Providers

Android Manifest File


BroadCast Receiver

Activities
Intents

Views Services
Content Providers

Android Manifest File


BroadCast Receiver

Activities
Provides a screen with which users can interact
Activity has UI. An app usually consists of multiple activities

1 Activity is always main. Activity has lifecycle

Activity Lifecycle

Activities
Intents

Views Services
Content Providers

Android Manifest File


BroadCast Receiver

Intents
Intents are simple message objects which are use to move from 1 activity to another Intent defines intention of what application want Intents can be use to communicate from 1 application to another

Intents

Intents

Intents

Activities
Intents

Views Services
Content Providers

Android Manifest File


BroadCast Receiver

Views
Views are UI basic building blocks

Know how to draw themselves Respond to events


Organized as trees to build up GUIs Described in XML in layout resources

Action Bar

UI Elements

Activities
Intents

Views Services
Content Providers

Android Manifest File


BroadCast Receiver

Android Manifest
It names the Java package for the application. Components of the application the activities, services, broadcast receivers, and content providers that the application is composed of. Permissions

Lists the library And more

Activities
Intents

Views Services
Content Providers

Android Manifest File


BroadCast Receiver

Services
Use to perform long running tasks in the background No User interface Runs in the background for certain amount of time

Use in combination with broadcast often to perform heavy operations like file upload sync etc

Service Lifecycle

Activities
Intents

Views Services
Content Providers

Android Manifest File


BroadCast Receiver

Content Providers
Helps in managing access to structure set of data Content providers are the standard interface that connects data in one process with code running in another process Provide a level of abstraction for data store in any format, in the file system, in sqllite or on network

Android platform provides common data like contacts calendars sms as content providers

App 2
Activity 1.1
Activity 1.

App 3
Activity 1.1
Activity 1.

Contact App
Activity 1.1

Content provider

Activity 1.

Sqllite db

File

Remote

Activities
Intents

Views Services
Content Providers

Android Manifest File


BroadCast Receiver

BroadCast Receiver
BroadCast receiver is android components which allows to register for system events Different kind of system events which do broadcast
o Battery low o Headset plugged o Location change o Sms received o Call received etc

Notifications
Notifies users about events happening in phone

It appears as a small icon in notification bar User Can interact with this notifications Sent via notification manager Example SMS, alarm, miss call

Android Development Environment

Eclipse IDE/ADT

UI Editor

The Emulator

Generating APK
Android application package file is the format to

distribute and install android app Apk can be Signed and unsigned
Generating signed and unsigned apk

Launch in marketplace
What is required? Typical launch process

Debugging
How to debug Using debug perspectives

Connecting your phone


Developing without emulator Debugging in phone

Questions ??

Thank You
Pranay.airan@iiitb.net http://goo.gl/okiJp

@pranayairan

Resources
Developer.android.com http://www.vogella.com/android.html http://www.mkyong.com/tutorials/android-tutorial/ Stackoverflow Books
o Hello Android o Basic android programming by mark murphy

Potrebbero piacerti anche