Android REST Client

Preview:

DESCRIPTION

good pattern for android REST application

Citation preview

@omayib

omayib@gmail.com

Facebook.com/omayib

75278432

omayib@gmail.com

arul_sip@yahoo.com

Arif Akbarul Huda

Penulis BukuMobile Apps Developer (android)

Buku ini cocok untuk buat mahasiswa yang pengen belajar membuat aplikasi android secara real. Dan nggak tanggung-tanggung, 9 Aplikasi yang bakal dibuat. Sangat excited baca buku ini, sambil buka editor tentunya. Pokoknya “Learning by Coding”!!

Yanuar Waskito (Alumni Universitas TELKOM Bandung)

pembayaran & buku dapat diambil di Kantor Technoporia dan Imagine IT Education Center (depan Goeboex Cafe Seturan Yogyakarta) pada tanggal 21-23 April 2014 | http://technophoriajogja.com

omayib.com atau bit.ly/bukuandroid

@omayib

omayib@gmail.com

Facebook.com/omayib

75278432

omayib@gmail.com

arul_sip@yahoo.com

Program Pelatihan on Class● 9 x pertemuan● Biaya (PM)● Tempat : Technoporia Building Depan Goebox

Cafe Seturan)● Waktu : soon!

omayib.com atau bit.ly/bukuandroid

@omayib

omayib@gmail.com

Facebook.com/omayib

75278432

omayib@gmail.com

arul_sip@yahoo.com

Agenda

REST ?

REST API example

REST vs mobile website

Incorect REST method implementation

Solution

conclussion

#TechTalk21

internet

HTTPGET,POST,PUT,DELETE dll

ResponJSON/XML

R.E.S.T

Client Server Architechture Style

Exchange Resources

Broadly Adapted

Commonly Used Over HTTP

1

2

3

4

https://api.foursquare.com/v2/venues/explore?limit=5&radius=3000&client_id=XS31V2WUHH45OXFCVNOZWJHXSW2GHSLQK55NUXMP4PVOIXPV&client_secret=1IOYKRN5CYO54RFMYSPMQKZA3VGXEKJQG43B0BJPEKRRV2L2&v=20130815&ll=-7.787874,110.367908&section=kuliner&time=any

REST API example

RESPON

REST vs

Mobile website?

1. Integration with platform2. run in background3. consistent UI4. user prefer native apps

Advantages Native Apps and REST

REST method implementation

Activity / UI thread

Worker thread

REST REQUEST

Incorect REST method implementation

WHY INCORECT ??

Infromasi Lab ..

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac venenatis est,,Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac venenatis est,,Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac venenatis est,,

Pengumuman Praktikum

OS my shut down process => killed during transaction

WHY ??

KILLED

Keyword :asynctaks, service, asyncadapter

● an intelligent Thread that is advised to be used. Intelligent as it can help with it’s methods, and there are two methods that run on UI thread, which is good to update UI components.

● Call from UI thread● Not for long brackground threat

AsyncTaks

● run in background ● no UI● run on UI thread (steel need worker thread)

Service

● Plugin architechture● Automated execution● Automated network checking● Improved battery performance● Account management and authentication

SyncAdapter

Good Pattern

good pattern using SERVICE–

Activity-UI thread

Service helper

service-UI thread

Workter thread

Content observer

respone

handler

parser

notify

CRUD

Content provider

Activity + cursor loader

Content provider

Sync adapter Network layer

CRUD

Get Data for sync Update cache

Content observernotification

Server request

good pattern using SYNCADAPTER–

Asyncatks : http://stackoverflow.com/questions/2531336/asynctask-wont-stop-even-when-the-activity-has-destroyed

Recommended