1page.title=Performing Network Operations 2page.tags=network,wireless 3 4trainingnavtop=true 5startpage=true 6next.title=Connecting to the Network 7next.link=connecting.html 8 9@jd:body 10 11<div id="tb-wrapper"> 12<div id="tb"> 13 14 15<h2>Dependencies and prerequisites</h2> 16<ul> 17 <li>Android 1.6 (API level 4) or higher</li> 18 <li>A device that is able to connect to mobile and Wi-Fi networks</li> 19</ul> 20 21 22<h2>You should also read</h2> 23<ul> 24 <li><a href="{@docRoot}training/monitoring-device-state/index.html">Optimizing Battery Life</a></li> 25 <li><a href="{@docRoot}training/efficient-downloads/index.html">Transferring Data Without Draining the Battery</a></li> 26 <li><a href="{@docRoot}guide/webapps/index.html">Web Apps Overview</a></li> 27 <li><a href="{@docRoot}training/volley/index.html">Transmitting Network Data Using Volley</a></li> 28</ul> 29 30 31<h2>Try it out</h2> 32 33<div class="download-box"> 34 <a href="{@docRoot}shareables/training/NetworkUsage.zip" 35class="button">Download the sample</a> 36 <p class="filename">NetworkUsage.zip</p> 37</div> 38 39</div> 40</div> 41 42<p>This class explains the basic tasks involved in connecting to the network, 43monitoring the network connection (including connection changes), and giving 44users control over an app's network usage. It also describes how to parse and 45consume XML data.</p> 46 47<p>This class includes a sample application that illustrates how to perform 48common network operations. You can download the sample (to the right) and use it 49as a source of reusable code for your own application.</p> 50 51<p>By going through these lessons, you'll have the 52fundamental building blocks for creating Android applications that download 53content and parse data efficiently, while minimizing network traffic.</p> 54 55<p class="note"><strong>Note:</strong> See the class <a href="{@docRoot} 56training/volley/index.html">Transmitting Network Data Using Volley</a> 57for information on Volley, an HTTP library that makes networking for Android apps 58easier and faster. Volley is available through the open 59<a href="https://android.googlesource.com/platform/frameworks/volley">AOSP</a> 60repository. Volley may be able to help you streamline and improve the performance 61of your app's network operations.</p> 62 63 64 65<h2>Lessons</h2> 66 67<dl> 68 <dt><b><a href="connecting.html">Connecting to the Network</a></b></dt> 69 70 <dd>Learn how to connect to the network, choose an HTTP client, and perform 71network operations outside of the UI thread.</dd> 72 73 <dt><b><a href="managing.html">Managing Network Usage</a></b></dt> 74 75 <dd>Learn how to check a 76device's network connection, create a preferences UI for controlling network 77usage, and respond to connection changes.</dd> 78 79 <dt><b><a href="xml.html">Parsing XML Data</a></b></dt> 80 <dd>Learn how to parse and consume XML data.</dd> 81 82</dl> 83 84