Getting started with android development
Download
1 / 84

Getting Started with Android Development - PowerPoint PPT Presentation


  • 111 Views
  • Uploaded on

Getting Started with Android Development. Rohit Ghatol. About Me. Rohit Ghatol Architect @QuickOffice Project Mgr @Synerzip Certified Scrum Master Author “ Beginning PhoneGap ” @Apress Founder TechNext Pune (Pune Developer Community). LinkedIn Profile. Topics. Understanding Android

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Getting Started with Android Development' - thy


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

About me
About Me

Rohit Ghatol

  • Architect @QuickOffice

  • Project Mgr @Synerzip

  • Certified Scrum Master

  • Author “Beginning PhoneGap” @Apress

  • Founder TechNext Pune (Pune Developer Community)

LinkedIn Profile


Topics
Topics

  • Understanding Android

  • Android Building Blocks

  • Putting Building Blocks Together

  • Latest things in Android World

  • Reference Material



What is android
What is Android?

  • Software stack for mobile devices that includes

    • an operating system

    • middleware

    • key applications

    • SDK to develop application






Android os capabilities
Android OS Capabilities

  • Phone and OS features

    • 3G/4G,GPS, Accelerometer, Compass, Camera, SQLite, Wifi, Bluetooth, etc

    • Near Field Communication

    • Cloud to Device Messaging (C2DM)

    • Direct Wifi


Android os capabilities1
Android OS Capabilities

  • Notable Features of Android

    • All Applications are equal

    • Reuse of Data

    • Reuse of Functionality


All applications are equal
All Applications are Equal

  • Replace Home Application

  • Replace Contacts, Dialer Applications

  • Replace SMS, Email Applications

  • Replace Settings Application

  • OEM Customizations (e.g HTC Sense)


Reuse of data
Reuse of Data

Default Contact Manager

New Contact Manager

Replaces

What happens to data feed into the default Contact Manager?


Reuse of data1
Reuse of Data

Default Contact Manager

New Contact Manager

Replaces

But Uses

Content Provider

“Replaces” means by default the new app is launched, but old app still exists


Reuse of functionality
Reuse of Functionality

My Coupons

Time to learn SMS API and Email API and code them into my application!

More code! Heehee

New Requirement

  • Share with Friends using

  • SMS

  • Email


Reuse of functionality1
Reuse of Functionality

Here are two applications who can do it for you?

My Coupons

SMS

Intention: Want to send Email

Mail


Reuse of functionality2
Reuse of Functionality

My Coupons

SMS

Mail


Reuse of functionality3
Reuse of Functionality

My Coupons

SMS

Mail


Android environment setup

Android Environment Setup

http://developer.android.com/sdk/installing.html


Getting started with android development

Eclipse

Android SDK

ADT

Android …..

SDK Manager

Manages

Android 2.2

Emulator

Emulator

Google API 2.2

AVD Manager

……………….

Android 3.2

Android 4.x


Android application
Android Application

Android Manifest

Dex File

Resources

MyApp.apk

Signed by

Self Signed

Private Key



Android build cycle
Android Build Cycle

.java

.class

.dex

.apk

javac

dx

apt

  • AndroidManifest.xml

  • resources



Getting started with android development

Dalvik VM

Uid 1

Uid 2

Uid 3

Linux Process

data

data

com.xyz.email

Dalvik

VM

Dalvik

VM

Dalvik

VM

shared_prefs

files

UID 1

databases

Process

Process

Process

com.abc.skype

. . . . . .

Linux Kernel

UID 2

com.koko.sukudo

. . . . . .

UID 3



Getting started with android development

Activity

Service

Broadcast Receiver

Content Resolver

Content Provider

Intents

Building Blocks

Other Components

Alarm Manager

Noti-fication Manager

……

Read more - http://developer.android.com/guide/topics/fundamentals.html

......









Understanding intent
Understanding Intent

  • Need

  • Class Name

  • Need

  • ACTION

  • CATEGORY

  • DATA


Program launcher
Program Launcher

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.sample“ android:versionCode="1“android:versionName="1.0">

<application android:icon="@drawable/icon" android:label="@string/app_name">

<activity android:name=".HelloWorld"

android:label="@string/app_name">

<intent-filter>

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>

</activity>

</application>

<uses-sdk android:minSdkVersion="4" />

</manifest>

Program launcher shows all the activities which have MAIN Action and LAUNCHER category


Conflicts with implicit intents
Conflicts with implicit Intents

So what happens two activities have the exact same intent filter and an intent is fired.

Simple you choose one application, and you have an option to tell to system that application as the default application hence forth


Intent api reference
Intent API Reference

  • Intent to launch an Activity

  • Context.startActivity(intent)

  • Context.startActivityForResult(intent)

  • Intent to launch an Service

  • Context.startService(intent)

  • Intent to send a broadcast

  • Context.sendBroadCast(intent)




Activity life cycle made easy
Activity Life Cycle (made easy)

Complete LifeCycle

onCreate

Visible LifeCycle

onStart

Foreground

LifeCycle

onResume

onPause

onStop

onDestroy


What to do in what method
What to do in what method?

onCreate

onStart

onResume

onPause

onStop

onDestroy



Calling service
Calling Service

Fire & Forget

Activity

startService(intent)

Service

void onStartCommand

(Intent intent,…){

}


Calling service1
Calling Service

RPC Style

Activity

  • bindService(intent)

  • …..

  • service.foo()

  • int result=service.bar()

Service

void foo(){

}

int bar(){

}



Broadcast receivers1
Broadcast Receivers

Network Change

Custom Event 1

Battery Low

App 1

Custom Event 2

App 2

Android OS

Interested in any of these Events.

Your App

Roaming

Boot


Broadcast receivers2
Broadcast Receivers

  • No Life Cycle Methods

  • Only Call back method

  • 10 second limit before ANR

  • Need not register with Android Manifest

  • Can be registered at Runtime




Building blocks of android
Building Blocks of Android

Phone Boots

Data Store(Email List)

Mail Sync

Activity

Service

Broadcast

Receiver

Content Provider/

SQL ite Database

Communication is using Intents


Getting started with android development

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Events..

Alarm M..

Notifi. M..


Getting started with android development

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

Data Store(Email List)

Phone Boots

Broadcast R

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

Data Store(Email List)

Phone Boots

Broadcast R

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

starts

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

Completes

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

Stores

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

Stores

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail Notification

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail Notification

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail Notification

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Getting started with android development

Data Store(Email List)

Phone Boots

Mail Sync

Database

Activity

Service

Broadcast R

Phone Boots

Mail Notification

Mail

Sync

(5 mins)

Events..

Alarm M..

Notifi. M..


Twitter app
Twitter App

  • All these Building blocks are covered in more detail on 3rd November at 3:40 p.m in “Building Twitter App for Android”



More about me
More about Me

  • Twitter - http://twitter.com/#!/rohitghatol

  • TechGig - http://www.techgig.com/rohitghatol

  • LinkedIn - http://www.linkedin.com/in/rohitghatol

  • Presentations - www.slideshare.net/rohitsghatol/

  • YouTube Tutorials - http://www.youtube.com/user/rohitssghatol