Retrofit 2 – Nhận dữ liệu từ Google – RSS

Author: - Posted: 20/06/20 - Update: 20/06/20

I. Link RSS từ Google

--XML search: https://news.google.de/news/feeds?pz=1&cf=vi_vn&ned=vi_vn&hl=vi_vn&q=MTP
- Thay "MTP" bằng cụm từ khóa tìm kiếm bất kỳ
- Dùng POSTMAN để kiểm tra API: https://www.postman.com/
- Dạng file RSS thường trông như sau:

II. Cấp quyền thư viện Retrofit 2

- Trang chủ: https://square.github.io/retrofit/

1. Implement thư viện

2. Cấp quyền Internet

III. Tạo các Class theo RSS

1. RssFeed.java

2. RssChannel.java

3. RssItem.java

IV. Tạo class của Retrofit 2

1. interface RetrofitAPI.Class

2. RetrofitBuilder.java

V. Sử dụng