Android encapsulates Retrofit2+OkHttp3+RxJava network requests

Now, Retrofit+RxJava+OkHttp is the most popular option in Android market. It is powerful and easy to use, so this solution is chosen to transform the network library. Introduction: Retrofit: Retrofit is a framework developed by Square Corporation that is requesting Android networks.The underlying implementation is based on OkHttp, which has bee ...

Posted on Wed, 14 Aug 2019 19:09:25 -0700 by AncientSage

HttpClient/HttpURLConnection + HttpDns Best Practices

On the Android side, if OkHttp serves as a network request framework, it can gracefully integrate HttpDns because it provides a custom DNS service interface. The related implementations can be referred to: HttpDns+OkHttp Best Practices. If you use HttpClient or HttpURLConnection to initiate network requests, although you cannot directly cust ...

Posted on Sat, 06 Jul 2019 12:15:47 -0700 by andrew_U

Introduction to Retrofit Use

Retrofit is an open source library for network requests developed by Square. It encapsulates okhttp internally and is perfectly compatible with RxAndroid, which makes Android development more efficient and makes the code more readable. This study is based on the previous okhttp study, and the service side of the program is built and compl ...

Posted on Thu, 04 Jul 2019 12:40:28 -0700 by cleromancer

A simple example of okhttp

OKHttp is an efficient HTTP client, which supports links connecting the same address to share the same socket, reduces response latency through connection pool, and has the advantages of transparent GZIP compression and request caching.  1. GET In OKHttp, every network request is a Request. We fill in the url, header and other parameters w ...

Posted on Mon, 01 Jul 2019 14:12:49 -0700 by unclemid

Create a Universal Network Request Engine HttpUtils

Create a Universal Network Request Engine HttpUtils Why build this engine? Xutils engine Okhttp Engine Use Why build this engine? Since Android 6.0, HttpClient has been abolished. Whether there is a lot of pain in APP, we should change the network request framework. Compatible with version 6.0. But it's not easy to change network reque ...

Posted on Wed, 26 Jun 2019 14:00:14 -0700 by ehmer

Retrofit2 Source Analysis (Clear Edition)

In the gradle configuration, a reference to retrofit is added. compile'com.squareup.retrofit2:retrofit:2.2.0' This article mainly analyses the underlying principles of the retrofit 2 framework. I downloaded version 2.2.0. I. How to Use Retrofit Let's first look at how Retrofit works. public interface GithubService{ @GET("user/{user} ...

Posted on Tue, 25 Jun 2019 16:57:25 -0700 by dreamcaster

Android OKhttp3 Cache Processing

It's easy to use: 1. Set up first: public static final MediaType MEDIA_TYPE_MARKDOWN = MediaType.parse("text/json; charset=utf-8");//Set MediaType private static final OkHttpClient client; private static final long cacheSize = 1024*1024*20;//Maximum Cached File Limit Size 20M private static String cachedirectory = FilePa ...

Posted on Tue, 11 Jun 2019 09:56:40 -0700 by neogeek

How to use Retrofit to request non-Restful API

Preface Since 2016, more and more Android developers have used Retrofit as an HTTP request framework. For one thing, Google released Android 6.0 SDK (API 23) abandoned HttpClient Second, Square released okhttp 3.0 on January 2, 2016, and Retrofit 2.0 on March 11, 2016. HttpClient Age As a generation of young people who are deeply poisoned by ...

Posted on Sun, 09 Jun 2019 19:15:49 -0700 by skulk

Automatic reconnection of WebSocket based on okhttp and RxJava encapsulation

I. overview 1. RxWebSocket is a Web Socket client based on okhttp and RxJava encapsulation. The core feature of this library is that besides closing WebSocket manually (that is, RxJava cancels subscriptions), WebSocket will automatically reconnect and continue to connect when it closes abnormally (onFailure, exceptions, such as WebSocket Ex ...

Posted on Wed, 22 May 2019 15:28:17 -0700 by Destruction

Print complete okhttp network request and response logs using logger

Printing complete okhttp network request and response logs using logger xiaoyanger follow 2017.01.17 00:31* Words 909 Reading 7107 Comments 14 Like 44 The network request tool used by our company in the project ...

Posted on Fri, 10 May 2019 11:46:16 -0700 by kof20012