Download ppt - Ruby conf2012

Transcript
Page 1: Ruby conf2012

EzSMS

Chandan JogHabibullah Pagarkar

Anand Agrawal

A simple SMS gateway for Androidin Ruby

Page 2: Ruby conf2012

Chandan Jog@jog_chandan

[email protected]

Page 3: Ruby conf2012

Habibullah Pagarkar@mhabibp

[email protected]

Page 4: Ruby conf2012

Intended Take-Aways

Why SMS?

Your options for building an SMS based app

Quick introduction to Android

A taste of Ruby on Android

Page 5: Ruby conf2012

SMS is omnipresent

Logical choice and not a “hot new” technology

Caters to the technically un-savvy

Page 6: Ruby conf2012

SMS is powerful

MOTECH and mHealthSuite of services

Basic mobile phonesAntenatal and neonatal care

Page 7: Ruby conf2012

SMS is useful

Page 8: Ruby conf2012

In the cloud

Page 9: Ruby conf2012

Or, deal with them

Page 10: Ruby conf2012

DIY

Page 11: Ruby conf2012

Can your grandma get it up?

http

://socia

lwebdaily

.com

/wp-co

nte

nt/u

plo

ads/2

01

1/1

2/

gra

ndm

a_m

em

e_la

rge1

.jpg

Page 12: Ruby conf2012

We <3

Page 13: Ruby conf2012

We <3

Page 14: Ruby conf2012

Anatomy of an Android app

http

://waly

ou.co

m/a

ndro

id-e

xplo

ded-

shirt/

Page 15: Ruby conf2012

Linux, but not quite

Linux kernel + Dalvik VM

No X. No GNU libraries. No JVM.

Page 16: Ruby conf2012

Activities

Visual components

Page 17: Ruby conf2012

Activities

An application consists of multipleloosely coupled Activities

Page 18: Ruby conf2012

Activities

An Activity is notified of change in state

through application life-cycle callbacks

Page 19: Ruby conf2012

Views and Layouts

Views and Widgets

Layout

Page 20: Ruby conf2012

Activity

Page 21: Ruby conf2012

Intent

Roughly analogous to a message

Page 22: Ruby conf2012

Intent

Use Intents to communicate

within components of an application

or between applications

Page 23: Ruby conf2012

Intent

Page 24: Ruby conf2012

Intent Filters

Explicit IntentsDesignate a target component by its

name

Implicit IntentsDo not name a target

Page 25: Ruby conf2012

Manifest

AndroidManifest.xml

Declaratively specify application components, services, permissions, minimum Android API version etc.

Page 26: Ruby conf2012
Page 27: Ruby conf2012

Service

BroadcastReceiver

ContentProvider

Page 28: Ruby conf2012

Open

DBAdapter.java

Page 29: Ruby conf2012

Whoa! It’s like, too much code, dude!

http

://aw

eso

mebm

ovie

s.com

/20

11

/04

/bill-a

nd-te

ds-b

ack

-in-a

ction/

Page 30: Ruby conf2012

options_from_collection_for_select

Page 31: Ruby conf2012

Konnichiwa, Ruboto-san

Aims to make JRuby a first class Android citizen

Lends to easy scripting

Maps underlying Android layer

Page 32: Ruby conf2012

Flavour 1

ruboto-irb

Interactive environment on the phone

Page 33: Ruby conf2012
Page 34: Ruby conf2012

Flavour 2

ruboto-core

Packages Ruby scripts as an APK

Page 35: Ruby conf2012

Pre-reqs

JRuby

Android SDK

Ruboto

Page 36: Ruby conf2012

Application Generator

$ ruboto gen app --package com.yourdomain.whatever --path path/to/app --name AppName --target android-version --min-sdk another-android-version --activity MainActivityName

Page 37: Ruby conf2012

Class Generator

$ ruboto gen class BroadcastReceiver --name AwesomenessReceiver

Page 38: Ruby conf2012

Packaging Tasks

$ rake install

$ rake update_scripts

$ rake install:clean

And many more with rake -T

Page 39: Ruby conf2012

Poll Box

A simple feedback gathering application

http://Poll-Box.com

Page 40: Ruby conf2012

http

://ww

w.ca

ribdire

ct.com

/20

12

/01

/31

/how

s-my-d

rivin

g-to

o-fa

st-too-b

ad/

How are we doing?

Page 41: Ruby conf2012

SMS 08800493714

code Y/N comment

ezsms Y The talk is awesome!

Page 42: Ruby conf2012

poll-box.com/response/102/ezsms

Page 43: Ruby conf2012

Talk is cheap

We’ll show youthe code

http

://en.w

ikipedia

.org

/wik

i/Linus_T

orv

ald

s

Page 44: Ruby conf2012

Fork it

github.com/chandanjog/ez_sms

Page 45: Ruby conf2012

Good news everyone!

Use your existing Ruby knowledge

Type less ;)

Best of both worldsAndroid APIs

RubyGems

http

://holly

woodhate

sme.fi

les.w

ord

pre

ss.com

/20

11

/09

/pro

f-farn

sworth

.jpg

Page 46: Ruby conf2012

Bad News

JRuby isn’t designed for constrained devices

Stack space limitations on the Dalvik VM

Ruboto doesn’t completely abstract away Android’s complexities

Slow JRuby start-up time

Page 47: Ruby conf2012

Recommended