In daily development, most applications basically need to connect to the network, send some data to the server, and then fetch some data from the server. Typically, android uses a Scoket and HTTP to connect to the Internet. HTTP requests teach Scoket a lot more. HTTP requests generally use the native HttpClient and HttpUrlConnection network access modes. Here are a few common Android web frameworks that will help you in your development.

Network framework


There are two commonly used network frameworks: the underlying network framework and the encapsulated network framework.

1. The underlying network framework

HttpClient, HttpURLConnection, and OkHttp are all low-level frameworks because they actually initiate Http network requests

1.HttpClient

HttpClient is the HTTP communication implementation library of the client. It implements HTTP GET and POST requests and obtains the response content. HttpClient is the original HTTP library provided by Apache corporation. Prior to 2.2, HttpClient was officially recommended.

The Apache web site hc.apache.org/index.html is where you can download the required Jar packages. Since HttpClient was deprecated in Android API 22, I won’t show you how to use it here.

    This interface was deprecated in API level 22. 
    Please use openConnection() instead. Please visit this webpage for further details.
Copy the code
2.HttpURLConnection

HttpURLConnection is a versatile, lightweight HTTP client that can be used for HTTP operations in most applications.

Stay tuned for future updates…