diff --git a/docs/html/guide/topics/connectivity/index.jd b/docs/html/guide/topics/connectivity/index.jd index 385cf08b4a3c3..9025d4d1c2489 100644 --- a/docs/html/guide/topics/connectivity/index.jd +++ b/docs/html/guide/topics/connectivity/index.jd @@ -7,21 +7,9 @@ page.landing.image=images/develop/connectivity.png
This class demonstrates the best practices for scheduling and executing downloads using @@ -29,14 +17,14 @@ techniques such as caching, polling, and prefetching. You will learn how the pow the wireless radio can affect your choices on when, what, and how to transfer data in order to minimize impact on battery life.
- +This class covers different strategies for cloud enabled applications. It covers syncing data with the cloud using your own back-end web application, and backing up data using the cloud so that users can restore their data when installing your application on a new device.
- +Fortunately, {@link javax.net.ssl.HttpsURLConnection} supports -SNI since Android 2.3. Unfortunately, Apache -HTTP Client does not, which is one of the many reasons we discourage its use. One workaround -if you need to support Android 2.2 (and older) or Apache HTTP Client is to set up an alternative +SNI since Android 2.3. One workaround +if you need to support Android 2.2 (and older) is to set up an alternative virtual host on a unique port so that it's unambiguous which server certificate to return.
The more drastic alternative is to replace {@link javax.net.ssl.HostnameVerifier} diff --git a/docs/html/training/basics/network-ops/connecting.jd b/docs/html/training/basics/network-ops/connecting.jd index 060148064a92b..798a9ee718d71 100644 --- a/docs/html/training/basics/network-ops/connecting.jd +++ b/docs/html/training/basics/network-ops/connecting.jd @@ -49,14 +49,10 @@ application manifest must include the following permissions:
Most network-connected Android apps use HTTP to send and receive data. -Android includes two HTTP clients: {@link java.net.HttpURLConnection} and the Apache HTTP client. -Both support HTTPS, streaming uploads and downloads, configurable -timeouts, IPv6, and connection pooling. We recommend using {@link -java.net.HttpURLConnection} for applications targeted at Gingerbread and higher. For -more discussion of this topic, see the blog post Android's HTTP Clients.
+Most network-connected Android apps use HTTP to send and receive data. The +Android platform includes the {@link java.net.HttpURLConnection} client, which +supports HTTPS, streaming uploads and downloads, configurable timeouts, +IPv6, and connection pooling.
{@code BasicNetwork} is Volley's default network implementation. A {@code BasicNetwork} must be initialized with the HTTP client your app is using to connect to the network. -Typically this is a {@link java.net.HttpURLConnection}:
-To create an app that runs on all versions of Android, you can check the version of -Android the device is running and choose the appropriate HTTP client, for example:
- -
-HttpStack stack;
-...
-// If the device is running a version >= Gingerbread...
-if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
- // ...use HttpURLConnection for stack.
-} else {
- // ...use AndroidHttpClient for stack.
-}
-Network network = new BasicNetwork(stack);
-
+Typically this is an {@link java.net.HttpURLConnection}.
This snippet shows you the steps involved in setting up a {@code RequestQueue}:
@@ -88,7 +63,7 @@ mRequestQueue = new RequestQueue(cache, network); // Start the queue mRequestQueue.start(); -String url ="http://www.myurl.com"; +String url ="http://www.example.com"; // Formulate the request and handle the response. StringRequest stringRequest = new StringRequest(Request.Method.GET, url, @@ -107,7 +82,8 @@ StringRequest stringRequest = new StringRequest(Request.Method.GET, url, // Add the request to the RequestQueue. mRequestQueue.add(stringRequest); -... + +// ...If you just need to make a one-time request and don't want to leave the thread pool @@ -198,7 +174,8 @@ class:
// Get a RequestQueue RequestQueue queue = MySingleton.getInstance(this.getApplicationContext()). getRequestQueue(); -... + +// ... // Add a request (in this example, called stringRequest) to your RequestQueue. MySingleton.getInstance(this).addToRequestQueue(stringRequest);