Top Banner
21

Android REST Client

May 25, 2015

Download

Technology

Arif Huda

good pattern for android REST application
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Android REST Client
Page 2: Android REST Client

@omayib

[email protected]

Facebook.com/omayib

75278432

[email protected]

[email protected]

Arif Akbarul Huda

Penulis BukuMobile Apps Developer (android)

Page 3: Android REST Client

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

[email protected]

Facebook.com/omayib

75278432

[email protected]

[email protected]

Page 4: Android REST Client

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

[email protected]

Facebook.com/omayib

75278432

[email protected]

[email protected]

Page 5: Android REST Client

Agenda

REST ?

REST API example

REST vs mobile website

Incorect REST method implementation

Solution

conclussion

#TechTalk21

Page 6: Android REST Client

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

Page 7: Android REST Client

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

Page 8: Android REST Client

REST vs

Mobile website?

Page 9: Android REST Client

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

Advantages Native Apps and REST

Page 10: Android REST Client

REST method implementation

Page 11: Android REST Client

Activity / UI thread

Worker thread

REST REQUEST

Incorect REST method implementation

Page 12: Android REST Client

WHY INCORECT ??

Page 13: Android REST Client

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

Page 14: Android REST Client

Keyword :asynctaks, service, asyncadapter

Page 15: Android REST Client

● 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

Page 16: Android REST Client

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

Service

Page 17: Android REST Client

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

SyncAdapter

Page 18: Android REST Client

Good Pattern

Page 19: Android REST Client

good pattern using SERVICE–

Activity-UI thread

Service helper

service-UI thread

Workter thread

Content observer

respone

handler

parser

notify

CRUD

Content provider

Page 20: Android REST Client

Activity + cursor loader

Content provider

Sync adapter Network layer

CRUD

Get Data for sync Update cache

Content observernotification

Server request

good pattern using SYNCADAPTER–

Page 21: Android REST Client

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