Droidcon Eastern Europe 2013 - Efficient REST client Android applications

Preview:

DESCRIPTION

Best practices when using REST clients in Java for Android presented by Eugeniu Arbuleac and Laurentiu Onac - Appsrise.com . The slides were presented at Droidcon Bucharest 2013.

Citation preview

Efficient

REST Clientapplications

by

Eugen Arbuleac & Laurentiu Onac

What is

REST?

What is REST?

client server architectural style1

2

3

4

exchanges resources

broadly adopted

commonly used over http

Mobile friendly web pages

VSREST Mobile apps

Apps advantages OVER Web sites

integration with the platform1

2

3

4

Run in background

Consistent UI

users prefer native apps

WrongAPPROACH

Wrong Approach

Activity - UI thread

Worker thread

REST Request

Wrong Approach

Limited memory

No persistence

21

GoodAPPROACH

Good Approach

Activity - UI thread

Service - UI thread

Content provider

Handler

Crud

NOTIFY

initiate rest request

Worker thread

REST Request

Content observer

Response

parser

service helper

callback

RESOURCE STATE UPDATE

Good Approach

Use services

1Use

worker threads

2

3Use

content providers

Even better Approach

Use push notifications

4

notify new dataserver

Even better Approach

Content provider

Sync adapter

Use Sync adapter

5

server

1. requestsyncdata

Handler

2. PASS sync data

3. INIT Request

4. Response

5. parse6. CRUD