| page.title=Network Monitor |
| parent.title=Android Monitor |
| parent.link=android-monitor.html |
| meta.tags="android, performance, profiling, tools, monitor" |
| page.tags="android", "performance", "profiling", "tools", "monitor" |
| page.metaDescription=Use the Network Monitor to analyze network requests, including how and when your app transfers data. Preserve battery life by optimizing network use. |
| page.image=tools/help/thumbnails/am-networkmon.png |
| page.article=true |
| |
| @jd:body |
| |
| <div id="qv-wrapper"> |
| <div id="qv"> |
| <h2>In this document</h2> |
| <ol> |
| <li><a href="#running">Displaying a Running App in the Network Monitor</a></li> |
| </ol> |
| |
| <h2>Video</h2> |
| <ol> |
| <li><a href="https://www.youtube.com/watch?v=fEEulSk1kNY" |
| class="external-link">Battery Drain and Networking</a></li> |
| </ol> |
| |
| </div> |
| </div> |
| |
| <p> |
| The Network Monitor makes it possible to track when your application is making network requests. |
| Using this tool, you can monitor how and when your app transfers data, and optimize the underlying |
| code appropriately. |
| </p> |
| |
| <p> |
| By monitoring the frequency of data transfers, and the amount of data transferred during each |
| connection, you can identify areas of your app that can be made more efficient and use less |
| battery power. |
| Generally, you should look for short spikes that can be delayed, or that could cause a later |
| transfer to be preempted. |
| </p> |
| |
| |
| <h2 id="running"> |
| Displaying a Running App in the Network Monitor |
| </h2> |
| |
| <p> |
| To display an app running on a particular device in the Network Monitor: |
| </p> |
| |
| <ol> |
| <li>Meet the <a href= |
| "{@docRoot}tools/help/am-basics.html#byb">prerequisites and dependencies</a>. |
| </li> |
| <p>Connect a hardware device; the Network Monitor doesn't monitor an emulator. |
| </p> |
| <li>Open an app project. |
| </li> |
| <li><a href= |
| "{@docRoot}tools/building/building-studio.html#RunningApp">Run the app</a> on the hardware device. |
| </li> |
| <li> |
| <a href="{@docRoot}tools/help/am-basics.html#displaying">Display Android Monitor</a>. |
| </li> |
| <li>Click the <strong>Monitors</strong> tab and <a href= |
| "{@docRoot}tools/help/am-basics.html#rearranging">display the Network Monitor</a>. |
| </li> |
| |
| <li>Enable the Network Monitor by clicking Pause <img src="{@docRoot}images/tools/am-ipause.png" |
| style="vertical-align:sub;margin:0;height:17px" alt="Pause icon" /> to deselect it. |
| </li> |
| |
| <p> |
| Any network traffic begins to appear in the Network Monitor: |
| </p> |
| <img src="{@docRoot}images/tools/am-networkmon2.png" style="vertical-align:sub;margin:0" /> |
| <p> |
| The Network Monitor adds up the amount of time it takes for the device to transmit and receive |
| kilobytes of data. |
| The y-axis is in kilobytes per second. The x-axis starts with seconds, and then minutes and |
| seconds, and so on. |
| </p> |
| <li>To stop the Network Monitor, click Pause <img src="{@docRoot}images/tools/am-ipause.png" |
| style="vertical-align:sub;margin:0;height:17px" alt="Pause icon" /> again to |
| select it. |
| </li> |
| </ol> |