parent
15d19eeb6c
commit
72a04b9b9f
2 changed files with 10 additions and 11 deletions
@ -1,3 +1,7 @@ |
|||||||
# OkHttp |
# OkHttp |
||||||
|
|
||||||
`OkHttp` is an HTTP client that's extremely efficient, enabling several advanced features in Android app or other platforms that use Java. Developed by Square, it's built for high efficiency and capacity, simplifying many networking tasks, including connection pooling, response caching, and request retries. OkHttp allows seamless recovery from network issues, minimizing the loss of data. The library ensures fewer errors and higher quality of service by using the modern TLS encryption, extensible request and response models, and a fluent API for ease of use and integration. |
`OkHttp` is an HTTP client that's extremely efficient, enabling several advanced features in Android app or other platforms that use Java. Developed by Square, it's built for high efficiency and capacity, simplifying many networking tasks, including connection pooling, response caching, and request retries. OkHttp allows seamless recovery from network issues, minimizing the loss of data. The library ensures fewer errors and higher quality of service by using the modern TLS encryption, extensible request and response models, and a fluent API for ease of use and integration. |
||||||
|
|
||||||
|
Visit the following resources to learn more: |
||||||
|
|
||||||
|
- [@official@Documentation](https://github.com/square/okhttp) |
||||||
|
@ -1,13 +1,8 @@ |
|||||||
# Retrofit |
# Retrofit |
||||||
|
|
||||||
Retrofit is a type-safe HTTP client for Android and Java. It's designed to connect your application with an API or a back-end web service. Retrofit uses annotations to encode details about the API's operations and requests, such as the HTTP method (GET, POST, PUT, DELETE, HEAD) and the query parameters. The main advantage of Retrofit over other similar libraries is in its simplicity and intuitiveness, and it efficiently handles all network calls. |
**Retrofit** is a type-safe HTTP client for Android. It's designed to connect your application with an API or a back-end web service. Retrofit uses annotations to encode details about the API's operations and requests, such as the HTTP method (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`) and the query parameters. The main advantage of **Retrofit** over other similar libraries is in its simplicity and intuitiveness, and it efficiently handles all network calls. |
||||||
``` |
|
||||||
Retrofit retrofit = new Retrofit.Builder() |
|
||||||
.baseUrl("https://api.example.com") |
|
||||||
.addConverterFactory(GsonConverterFactory.create()) |
|
||||||
.build(); |
|
||||||
|
|
||||||
ExampleService service = retrofit.create(ExampleService.class); |
Visit the following resources to learn more: |
||||||
Call<ExampleResponse> call = service.exampleCall(); |
|
||||||
``` |
- [@oficial@Documentation](https://square.github.io/retrofit/) |
||||||
The `baseUrl()` is your API base URL. The `addConverterFactory()` specifies a factory to use for serialization and deserialization. In the example above, the Gson library will handle the conversion of JSON data. The `build()` call finishes the builder and returns the retrofit instance. Finally, `create()` generates an implementation of the `ExampleService` interface. |
- [@video@Retrofit in Android Studio](https://www.youtube.com/watch?v=KJSBsRKqNwU) |
||||||
|
Loading…
Reference in new issue