slide android application and rest service 0503

28
ANDROID APPLICATION AND REST SERVICE Trình bày: Trang Hồng Sơn Email: [email protected]

Upload: phung-tran

Post on 22-Jan-2018

275 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Slide android application and rest service 0503

ANDROID APPLICATION AND REST SERVICE

Trình bày: Trang Hồng SơnEmail: [email protected]

Page 2: Slide android application and rest service 0503

THÔNG TIN CHUNG

Page 3: Slide android application and rest service 0503

Nội dung

[1] Bài giảng “Lập trình Android”, Trung tâm tin học - Trường Đại học Khoa học tự nhiên TPHCM.

[2] Tutorial “Development and Deployment of REST Web Services in JAVA”, Software Engineering Competence Center.

[3] https://en.wikipedia.org/wiki/JSON

ANDROID [1] REST SERVICE [2] JSON [3]

ANDROID

vs

REST SERVICE

Page 4: Slide android application and rest service 0503

ANDROID

Page 5: Slide android application and rest service 0503

Android - Lịch sử phát triển

Năm 2003, Android Inc. được thành lập bởi Andy Rubin, Rich Miner, NickSears và Chris White tại California.

Năm 2005, Google sở hữu Android cùng với các vị trí quản lý.

Năm 2007, OHA (Open Handset Alliance) được thành lập bởi Google cùng vớinhiều nhà sản xuất thiết bị phần cứng, thiết bị không dây và vi xử lý. Công bốnền tảng phát triển Android.

Năm 2008, thiết bị HTC Dream là phiên bản thế hệ đầu tiên hoạt động với hệđiều hành Android 1.0.

Năm 2010, Google khởi đầu dòng thiết bị Nexus với thiết bị đầu tiên của HTClà Nexus One.

Năm 2013, ra mắt loạt thiết bị phiên bản GPE.

Năm 2014, Google công báo Android Wear, hệ điều hành dành cho các thiếtbị đeo được.

Page 6: Slide android application and rest service 0503

Android – Các phiên bản Android

Page 7: Slide android application and rest service 0503

Android - Xu thế phát triển công nghệ di động

Page 8: Slide android application and rest service 0503

Android - Xu thế phát triển công nghệ di động

Page 9: Slide android application and rest service 0503

Android - Xu thế phát triển công nghệ di động

Tổng dân sốđang sử

dụngSmartphone

Người dùngSmartphone sử

dụng dịch vụ tìmkiếm địa điểm trên

điện thoại

Người dùngSmartphone tra cứuthông tin sản phẩmtrên điện thoại của

họ

Người dùngSmartphone thanhtoán trực tiếp trênđiện thoại của họ

20% 97% 95% 60%

SỬ DỤNG SMARTPHONE

Page 10: Slide android application and rest service 0503

Android - Xu thế phát triển công nghệ di động

278%266%

247%237%

211% 209% 209%

189%182% 177% 176% 171%

0

50

100

150

200

250

300

Fastest Growing iOS & Android Markets by Active Devices (%)

Colombia Vietnam Turkey Ukraine Egypt China Chile India Venezuela S. Africa Thailand Philippines

Page 11: Slide android application and rest service 0503

Android - Xu thế phát triển công nghệ di động

Page 12: Slide android application and rest service 0503

Android - Thị trường thiết bị Android

Page 13: Slide android application and rest service 0503

Android - Kiến trúc Android

Android được hình thành dựa trên nền tảng Linux nhân 2.6, từ phiên bản

4.0 sử dụng Linux nhân 3.x.

Android bao gồm 3 thành phần chính:

o Middleware

o Các thư viện và API viết bằng C

o Các ứng dụng thực thi viết bằng Java

Sử dụng máy ảo Dalvik để biên dịch mã .dex (Dalvik Excuteable) sang

Java bytecode.

Page 14: Slide android application and rest service 0503

Android - Kiến trúc Android

Page 15: Slide android application and rest service 0503

Android - Ngôn ngữ lập trình

Java C/C++ JNI

XMLRender Script

Page 16: Slide android application and rest service 0503

Android

MÔI TRƯỜNG PHÁT TRIỂN ỨNG DỤNG

Android Developer Tools Bundle (ADT)

Android Studio

Page 17: Slide android application and rest service 0503

REST SERVICE

Page 18: Slide android application and rest service 0503

Rest Service

It was first introduced in 2000 by Roy Fielding at the University ofCalifornia.

REST (Representational State Transfer) is a technology relies on astateless, client-server, cacheable communications technology thatuses the HTTP protocol.

REST is considered as an architectural style for developingapplications that communicate over the network.

Page 19: Slide android application and rest service 0503

Rest Service

It defines a set of architectural principles by which you can design web

services that focus on the concept of system's resources, including how

resource states are addressed and transferred over the HTTP protocol by

various client applications written in different programming languages.

In REST, the web services are viewed as resources and can be identified by

their URLs (sometimes called URIs). Web service clients that want to use

these resources and access a particular representation will need to use a

globally defined set of remote methods that describe the action to be

performed on the resource.

Page 20: Slide android application and rest service 0503

Rest Service

Similar to "methods" or "services" used in Remote Procedure Call (RPC) and

SOAP Web Services, to access the price of a product, do not need to call a

"getProductName" and then a "getProductPrice" RPC calls; rather, can view

the product data as a resource by just calling a GET request for this URI, and

this resource should contain all the required information.

RESTful applications use HTTP requests to post data (create and/or

update), read data (like queries), and delete data. Thus, REST uses HTTP for

all four CRUD (Create/Read/Update/Delete) operations, so it is lightweight

and simple alternative to the complex mechanisms stated above.

Page 21: Slide android application and rest service 0503

Rest Service

REST COMMUNICATION MODEL

Page 22: Slide android application and rest service 0503

JSON

Page 23: Slide android application and rest service 0503

JSON

JSON (JavaScript Object

Notation) is an open-standard

format that uses human-readable

text to transmit data objects

consisting of attribute–value

pairs.

JSON is a language-independent

data format, is the most common

data format used for client/server

communication, largely replacing

XML.

Page 24: Slide android application and rest service 0503

ANDROIDvs

REST SERVICE

Page 25: Slide android application and rest service 0503

Android vs Rest Service

REST as Lightweight Web Services:

o Platform-independent (you don't care whether the server is Unix, the

client is MacOS, or Windows),

o Language-independent (C# can talk to Java, ...),

o Standards-based (runs on top of HTTP, XML, JSON, …),

o Easily used in the presence of firewalls, as it is simply using the popular

HTTP protocol that can bypass any firewalls used.

Advantages of using REST in Android:

o Make client more lightweight

o Re-usage of existing functionalities

o Remote DB hit made simple

Page 26: Slide android application and rest service 0503

Android vs Rest Service

Page 27: Slide android application and rest service 0503

Android vs Rest Service

Building ANDROID application vs REST service:

o Create Website

Implement REST services in the Website

Deploy Website on the host

o Create ANDROID application to invoke REST services

Demo

Page 28: Slide android application and rest service 0503

Cám ơn sựlắng nghe và chia sẻ !!!

Trình bày: Trang Hồng SơnEmail: [email protected]