共用方式為


How to simulate a low-bandwidth connection or poor signal for Windows Phone 8

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

This topic describes how you can simulate a slow network speed, a weak signal, or the absence of a network connection while you’re running your app on the emulator or a connected device to test how your app handles these conditions.

You can use the Simulation Dashboard in Visual Studio to test your app for these connection problems, and to help prevent users from encountering scenarios like the following:

  • High-resolution music or videos stutter or freeze while streaming, or take a long time to download over a low-bandwidth connection.

  • Calls to a web service fail with a timeout.

  • The app crashes when no network is available.

  • Data transfer does not resume when the network connection is lost and then restored.

  • The user’s battery is drained by a streaming app that uses the network inefficiently.

  • Mapping the user’s route is interrupted in a navigation app.

This topic contains the following sections.

Network simulation options

The following illustration shows the options that are available in the Simulation Dashboard in Visual Studio for network simulation.

Network speed options

You can choose any of the following values for Network Speed on the Simulation Dashboard. However, you can’t simulate a higher-bandwidth connection than the actual connection of the emulator or the connected device. Also, you can’t simulate a high-bandwidth Wi-Fi connection when you run your app on a device that has a cellular connection.

  • 2G

  • 3G

  • 4G

  • Wi-Fi

  • No Network

Note

You can’t use the Simulation Dashboard to test Data Sense code by changing the network type between cellular and Wi-Fi, or by turning off the network. The Simulation Dashboard does not change the values of the properties on which the Data Sense API depends. For more information about using the Data Sense API to adjust data usage, see How to adjust data usage using the Data Sense API for Windows Phone 8.

Signal strength options

You can choose one of the following values for Signal Strength on the Simulation Dashboard. However, you can’t simulate a stronger signal than the actual signal of the emulator or the device.

  • Good

  • Average

  • Poor

When you select No Network under Network Speed, then signal strength does not apply and the Signal Strength slider is disabled.

The Signal Strength option that you select affects the following characteristics of network communications:

  • Upload and download bandwidth.

  • Packet loss rate.

  • Network latency.

Simulating a low-bandwidth connection or poor signal

The network simulation feature in the Simulation Dashboard isn’t synchronized with the actual networking connection of the target device. For example, if you are testing your app on a phone and you manually switch from a cellular to a Wi-Fi connection on the phone itself, the new connection does not use the simulation settings from the dashboard. To apply the network simulations to the new connection, you have to clear and then reselect the settings you want to use in the Simulation Dashboard.

To simulate a low-bandwidth connection or poor signal

  1. Run your app on the emulator or a connected device, with or without debugging.

    Or, run your app with app monitoring and profiling to measure its quality and performance. For more information, see Windows Phone Application Analysis for Windows Phone 8.

  2. In Visual Studio, on the Tools menu, open Simulation Dashboard. Find the network simulation section of the dashboard and check the Enable Network Simulation check box.

Important Note:

When you enable network simulation on a device for the first time, you will be prompted to restart the device.

  1. Move the sliders to change values for Network Speed or Signal Strength.

  2. Click Apply.

  3. Test how your app handles the simulated low-bandwidth connection or poor signal.

  4. Later, to restore the network settings to their default values, do one of the following:

    • Clear the Enable Network Simulation check box.

    • Close the Simulation Dashboard.

    • Disconnect the device.

    • Shut down or restart the emulator or the device.

    • Close Visual Studio.