consuming web services in android

27
Consuming Web Services

Upload: david-truxall

Post on 17-May-2015

322 views

Category:

Technology


0 download

DESCRIPTION

My presentation from Michigan Google Developers DevFest 2013. As mobile apps continue to get more sophisticated, they need data, whether it’s the from the business backend or the current scoreboard for a game server hosted in the cloud. Find out how to connect to and consume web services with your Android application. Get connected to the cloud, working with REST web services and learning how to parse the results.

TRANSCRIPT

Page 1: Consuming Web Services in Android

Consuming Web Services

Page 2: Consuming Web Services in Android

Mobile • Develop • Design • Lead • Train • Troubleshoot

David Truxall, Ph.D.

@davetrux

http://blog.davidtruxall.com

Page 3: Consuming Web Services in Android

https://github.com/davetrux/DevFest2013

Get the code

Page 4: Consuming Web Services in Android

The Mobile Problem

(for developers)

Page 5: Consuming Web Services in Android

Screen Real Estate

Page 6: Consuming Web Services in Android

CPU Power

Page 7: Consuming Web Services in Android

Memory Constrained

Page 8: Consuming Web Services in Android

Network Bandwidth

Page 9: Consuming Web Services in Android

Familiar?

Page 10: Consuming Web Services in Android

XML

JSON

Web Services

Soap

REST

Page 11: Consuming Web Services in Android

REpresentational State Transfer

GET

POST

PUT

DELETE

Page 12: Consuming Web Services in Android

JavaScript Object Notation[ { "lastName": "Valdez", "firstName": "Christian", "gender": "m" }, { "lastName": "Alston", "firstName": "Christie", "gender": "f" }]

Page 13: Consuming Web Services in Android

Where?

GoogleAmazonTwitterFacebookeBayBaas Providersprogrammableweb.com

Windows AzureGovernmentLinkedInFlickrYahooYelpYour company

Build Some!

Page 14: Consuming Web Services in Android

Web Services and Android

Page 15: Consuming Web Services in Android

Lots of Options

Page 16: Consuming Web Services in Android

Not in an Activity

Page 17: Consuming Web Services in Android

AsyncTask vs. Service

Page 18: Consuming Web Services in Android

AsyncTask

Page 19: Consuming Web Services in Android

Activity Considerations

Active when request completes

Paused then resumed and request completes

Paused when request completes then resumed

Page 20: Consuming Web Services in Android

Demo

Page 21: Consuming Web Services in Android

Services

Not a daemon or Windows Service

Like a cron job or scheduled task

Page 22: Consuming Web Services in Android

IntentService vs. Service

Page 23: Consuming Web Services in Android

Activity

IntentService

IntentServiceWeb

Services

Intent w/URL & params

REST + JSON

Intent w/data

Page 24: Consuming Web Services in Android

Code

Page 25: Consuming Web Services in Android

What's Missing

Persistence

HTTP Headers

Error Handling

Security

Configuration

Page 26: Consuming Web Services in Android

Performance

Data size

Paging

gzip