• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Volley overview
2
3Volley is an HTTP library that makes networking for Android apps easier and most importantly,
4faster. Volley is available on [GitHub](https://github.com/google/volley).
5
6Volley offers the following benefits:
7
8- Automatic scheduling of network requests.
9- Multiple concurrent network connections.
10- Transparent disk and memory response caching with standard HTTP
11  [cache coherence](https://en.wikipedia.org/wiki/Cache_coherence).
12- Support for request prioritization.
13- Cancellation request API. You can cancel a single request, or you can set blocks or scopes of
14  requests to cancel.
15- Ease of customization, for example, for retry and backoff.
16- Strong ordering that makes it easy to correctly populate your UI with data fetched asynchronously
17  from the network.
18- Debugging and tracing tools.
19
20Volley excels at RPC-type operations used to populate a UI, such as fetching a page of
21search results as structured data. It integrates easily with any protocol and comes out of
22the box with support for raw strings, images, and JSON. By providing built-in support for
23the features you need, Volley frees you from writing boilerplate code and allows you to
24concentrate on the logic that is specific to your app.
25Volley is not suitable for large download or streaming operations, since Volley holds
26all responses in memory during parsing. For large download operations, consider using an
27alternative like
28[`DownloadManager`](https://developer.android.com/reference/android/app/DownloadManager).
29
30The core Volley library is developed on [GitHub](https://github.com/google/volley) and
31contains the main request dispatch pipeline as well as a set of commonly applicable utilities,
32available in the Volley "toolbox." The easiest way to add Volley to your project is to add the
33following dependency to your app's build.gradle file:
34
35*Groovy*
36
37```groovy
38dependencies {
39    implementation 'com.android.volley:volley:1.2.1'
40}
41```
42
43*Kotlin*
44
45```kotlin
46dependencies {
47    implementation("com.android.volley:volley:1.2.1")
48}
49```
50
51You can also clone the Volley repository and set it as a library project:
52
531. Git clone the repository by typing the following at the command line:
54
55    ```console
56    git clone https://github.com/google/volley
57    ```
58
592. Import the downloaded source into your app project as an Android library module as described
60   in [Create an Android Library](https://developer.android.com/studio/projects/android-library).
61
62## Lessons
63
64[**Send a simple request**](./simple.md)
65
66Learn how to send a simple request using the default behaviors of Volley, and how
67to cancel a request.
68
69[**Set up RequestQueue**](./requestqueue.md)
70
71Learn how to set up a `RequestQueue`, and how to implement a singleton
72pattern to create a `RequestQueue` that lasts the lifetime of your app.
73
74[**Make a standard request**](./request.md)
75
76Learn how to send a request using one of Volley's out-of-the-box request types
77(raw strings, images, and JSON).
78
79[**Implement a custom request**](./request-custom.md)
80
81Learn how to implement a custom request.
82