Partager via


Test app features in Windows Phone Emulator

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

Simulate real-world interaction with a device and test the features of your app by using the tools included with Windows Phone Emulator.

Windows Phone Emulator is designed to provide comparable performance to an actual device. Before you publish your app to the Windows Phone Store, however, we recommend that you test your app on a physical device.

For general info about the emulator, see Run Windows Phone apps in the emulator.

Features that you can test in the emulator

Test the following commonly used features in Windows Phone Emulator.

  • Screen resolution, screen size, and memory. Reach a broad market for your app by testing it on various emulator images to simulate various screen resolutions, physical sizes, and memory constraints.

  • Screen configuration. Change the emulator from portrait to landscape mode. Change the zoom setting to fit the emulator to your desktop screen.

  • Networking. Networking support is integrated with Windows Phone Emulator. Networking is enabled by default. You do not have to install network drivers for Windows Phone Emulator or configure networking options manually in most environments.

    The emulator uses the network connection of the host computer. It does not appear as a separate device on the network. This eliminates some of the configuration issues that users encountered with the Windows Phone SDK 8.0 emulator.

  • Language and region settings. Prepare your app for an international market by changing the display language and region settings in Windows Phone Emulator.

    On the running emulator, go to the Settings app, then select the system settings, then select language or region. Change the settings that you want to test. If you're prompted, click restart phone to apply the new settings and restart the emulator.

  • Application lifecycle and tombstoning. Test the behavior or your app when it's deactivated or tombstoned by changing the value of the option Tombstone upon deactivation while debugging on the Debug page of project properties.

  • Local folder storage (previously known as isolated storage). Data in isolated storage persists while the emulator is running, but is lost once the emulator closes.

  • Microphone. Requires and uses the microphone on the host computer.

  • Lock screen. With the emulator open, press F12 on your computer keyboard twice. The F12 key emulates the power button on the phone. The first key press turns off the display. The second key press turns the display on again with the lock screen engaged. Unlock the screen by using the mouse to slide the lock screen upward.

Features that you can't test in the emulator

Test the following features only on a physical device.

  • Compass
  • Gyroscope
  • Vibration controller
  • Brightness. The brightness level of the emulator is always High.
  • High-resolution video. Videos with a resolution higher than VGA resolution (640 x 480) cannot be displayed reliably, especially on emulator images with only 512MB of memory.

Multi-point input

Simulate multi-touch input for pinching and zooming, rotating, and panning objects by using the Multi-touch Input button on the emulator toolbar. This feature is useful if your app displays photos, maps, or other visual elements that users can pinch and zoom, rotate, or pan.

  1. Tap the Multi-touch Input button on the emulator toolbar to enable multi-point input. Two touch points appear on the emulator screen around a center point.
  2. Right-click and drag one of the touch points to position them without touching the screen.
  3. Left-click and drag one of the touch points to simulate pinching and zooming, rotating, or panning.
  4. Tap the Single Point Input button on the emulator toolbar to restore normal input.

The following screenshot shows multi-touch input.

  1. The small left image shows the Multi-touch Input button on the emulator toolbar.
  2. The middle image shows the emulator screen after tapping the Multi-touch Input button to display the touch points.
  3. The right image shows the emulator screen after dragging the touch points to zoom the image.

Accelerometer

Test apps that track the movement of the phone by using the Accelerometer tab of the emulator's Additional Tools.

You can test the accelerometer sensor with live input or pre-recorded input. The only type of recorded data that’s available simulates shaking the phone. You can’t record or save your own simulations for the accelerometer.

  1. Select the desired starting orientation in the Orientation drop-down list.

    • Select the type of input.

      To run the simulation with live input

      In the middle of the acceleromater simulator, drag the colored dot to simulate movement of the device in a 3D plane.

      Moving the dot on the horizontal access rotates the simulator from side to side. Moving the dot on the vertical access rotates the simulator back and forth, rotating around the x-axis. As you drag the dot, the X, Y, and Z coordinates update based on the rotation calculations. You cannot move the dot outside the bounding circle in the touch pad area.

      Optionally, click Reset to restore the starting orientation.

    • To run the simulation with recorded input

      In the Recorded Data section, click the Play button to start playback of the simulated data. The only option available in the Recorded Data list is shake. The simulator does not move on the screen when it plays back the data.

Location and driving

Test apps that use navigation or geofencing by using the Location tab of the emulator's Additional Tools. This feature is useful for simulating driving, biking, or walking in conditions similar to the real world.

You can test your app while you simulate moving from one location to another at different speeds and with different accuracy profiles. The location simulator can help you to identify changes in your usage of the location APIs usage that improve the user experience. For example, the tool can help you identify that you have to tune geofence parameters, such as size or dwell time, to detect the geofences successfully in different scenarios.

The Location tab supports three modes. In all modes, when the emulator receives a new position, that position is available to trigger the PositionChanged event or to respond to a GetGeopositionAsync call in your location-aware app.

  • In Pin mode, you place pushpins on the map. When you click Play all points, the location simulator sends the location of each pin to the emulator one after another, at the interval specified in the Seconds per pin text box.

  • In Live mode, you place pushpins on the map. The location simulator sends the location of each pin to the emulator immediately as you place them on the map.

  • In Route mode, you place pushpins on the map to indicate waypoints, and the location simulator automatically calculates a route. The route includes invisible pins at one-second intervals along the route. For example, if you have select the Walking speed profile, which assumes a speed of 5 kilometers per hour, then invisible pins are generated at intervals of 1.39 meters. When you click Play all points, the location simulator sends the location of each pin to the emulator one after another, at the interval determined by the speed profile selected in the drop-down list.

In all modes of the location simulator, you can do the following things.

  • You can search for a location by using the Search box.

  • You can Zoom in and Zoom out on the map.

  • You can save the current set of data points to an XML file, and reload the file later to reuse the same data points.

  • You can Toggle pushpin mode on or off and Clear all points.

In Pin and Route mode, you can also do the following things.

  • Save a route you created for later use.

  • Load a route previously created. You can even load route files created in previous versions of the tool.

  • Modify a route by deleting pushpins (in Pin mode) or waypoints (in Route mode).

Accuracy profiles

In all modes of the location simulator, you can select one of the following accuracy profiles in the Accuracy profile drop-down list.

Profile Description
Pinpoint Assumes perfectly accurate location readings. This setting is not realistic, but it's useful for testing the logic of your app.
Urban Assumes that buildings are restricting the number of satellites in view, but there is often a high density of cell towers and Wi-Fi access points that can be used for positioning.
Suburban Assumes that satellite positioning is relatively good and there is good density of cell towers, but the density of Wi-Fi access points is not high.
Rural Assumes that satellite positioning is good, but there is low density of cell towers and almost no Wi-Fi access points that can be used for positioning.

 

Speed profiles

In Route mode, you can select one of the following speed profiles in the drop-down list.

Profile Speed per hour Speed per second Description
Speed Limit Speed limit of the route Not applicable Traverse the route at the posted speed limit.
Walking 5 km/h 1.39 m Traverse the route at a natural walking pace of 5 km/h.
Biking 25 km/h 6.94 m Traverse the route at a natural biking pace of 25 km/h.
Fast Traverse the route faster than the posted speed limit.

 

Route mode

Route mode has the following features and limitations.

  • Route mode requires an Internet connection.

  • When the Urban, Suburban, or Rural accuracy profile is selected, the location simulator calculates a simulated satellite-based position, a simulated Wi-Fi position, and a simulated cellular position for each pin. Your app receives only one of these positions. The three sets of coordinates for the current location are displayed in different colors on the map and in the Current location list.

  • The accuracy of the pins along route the route is not uniform. Some of the pins use satellite accuracy, some use Wi-Fi accuracy, and some use cellular accuracy.

  • You cannot select more than 20 waypoints for the route.

  • Positions for the visible and invisible pins on the map are generated only once when you select a new accuracy profile. When you play the route more than once with the same accuracy profile during the same emulator session, the previously generated positions are reused.

The following screenshot shows Route mode. The orange line indicates the route. The blue dot indicates the accurate location of the car determined by satellite-based positioning. The red and green dots indicate less accurate locations calculated by using Wi-Fi and cellular positioning and the Suburban accuracy profile. The three calculated locations are also displayed in the Current location list.

More info about the location simulator

  • You can request a position with the accuracy set to Default. A limitation that existed in the Windows Phone 8 version of the location simulator, and required you to request a position with the accuracy set to High, has been fixed.

  • When you test geofencing in the emulator, create a simulation that gives the geofencing engine a “warm-up” period to learn and adjust to the movement patterns.

  • The only position properties that are simulated are the Latitude, Longitude, Accuracy, and PositionSource. The location simulator does not simulate other properties such as Speed, Heading, and so forth.

Network

Test your app with different network speeds and different signal strengths by using the Network tab of the emulator's Additional Tools. This feature is useful if your app calls web services or transfers data.

The network simulation feature helps you to make sure that your app runs well in the real world. The Windows Phone Emulator runs on a computer that usually has a fast WiFi or Ethernet connection. Your app, however, runs on phones that are typically connected over a slower cellular connection.

  1. Check Enable network simulation to test your app with different network speeds and different signal strengths.
  2. In the Network speed dropdown list, select one of the following options:
    • No network
    • 2G
    • 3G
    • 4G
  3. In the Signal strength dropdown list, select one of the following options:
    • Good
    • Average
    • Poor
  4. Clear Enable network simulation to restore the default behavior, which uses the network settings of your development computer.

You can also review the current network settings on the Network tab.

SD card

Test your app with a simulated removable SD card by using the SD Card tab of the emulator's Additional Tools. This feature is useful if your app reads or write files.

For more info about how to use removable storage in a Windows Phone app, see Store and access files on the microSD card.

The SD Card tab uses a folder on the development computer to simulate a removable SD card in the phone.

  1. Select a folder.

    Click Browse to pick a folder on the development computer to hold the contents of the simulated SD card.

  2. Insert the SD card.

    After selecting a folder, click Insert SD card. When you insert the SD card, the following things happen:

    • If you didn't specify a folder, or the folder's not valid, an error occurs.
    • The files in the specified folder on the development computer are copied to the root folder of the simulated SD card on the emulator. A progress bar indicates the progress of the sync operation.
    • The Insert the SD card button changes to Eject SD card.
    • If you click Eject SD card while the sync operation is in progress, the operation is canceled.
  3. Optionally, select or clear Sync updated files back to the local folder when I eject the SD card.

    This option is enabled by default. When this option is enabled, files are synced from the emulator back to the folder on the development computer when you eject the SD card.

  4. Eject the SD card.

    Click Eject SD card. When you eject the SD card, the following things happen:

    • if you have selected Sync updated files back to the local folder when I eject the SD card, the following things happen:
      • The files on the simulated SD card on the emulator are copied to the specified folder on the development computer. A progress bar indicates the progress of the sync operation.
      • The Eject SD card button changes to Cancel sync.
      • If you click Cancel sync while the sync operation is in progress, the card is ejected and the results of the sync operation are incomplete.
    • The Eject SD card button changes back to Insert SD card.

Note  

Since an SD card used by the phone is formatted with the FAT32 file system, 32GB is the maximum size.

The speed of reading from and writing to the simulated SD card is throttled to imitate real-world speeds. Accessing an SD card is slower than accessing the computer's hard drive.

 

Notifications

Send push notifications to your app by using the Notifications tab of the emulator's Additional Tools. This feature is useful if your app receives push notifications.

You can easily test push notifications without creating the working cloud service that's required after you publish your app.

  1. Enable simulation.

    After you select Enabled, all apps deployed on the emulator use the simulation engine instead of the WNS or MPN service until you disable simulation.

  2. Select an app to receive notifications.

    The AppId list is automatically populated with all apps deployed to the emulator that are enabled for push notifications. Select an app in the drop-down list.

    If you deploy another push-enabled app after enabling simulation, click Refresh to add the app to the list.

    • For Windows Phone 8.1 apps, including Silverlight 8.1 apps, the Product Family Name (PFN) is displayed.

    • For Windows Phone 8.0 apps, the ProductId is displayed.

  3. Select a notification channel.

    After you select an app in the AppId list, the URI list is automatically populated with all the notification channels registered for the selected app. Select a notification channel in the drop-down list.

  4. Select a notification type.

    After you select a notification channel in the URI list, the Notification Type list is automatically populated with all the types available for the notification service. Select a notification type in the drop-down list.

    The simulator uses the Uri format of the notification channel to determine whether the app is using WNS or MPN push notifications.

    Simulation supports all notification types. The default notification type is Tile.

    • The following WNS notification types are supported.

      • Raw

      • Toast

        When your app uses WNS notifications and you select the Toast notification type, the simulation tab displays the Tag and Group fields. You can select these options and enter Tag and Group values to manage toast notifications in the Notification Center.

      • Tile

      • Badge

    • The following MPN notification types are supported.

      • Raw
      • Toast
      • Tile
  5. Select a notification template.

    After you select a notification type in the Notification Type list, the Templates list is automatically populated with all the templates available for the notification type. Select a template in the drop-down list.

    Simulation supports all template types.

  6. Optionally, change the notification payload.

    After you select a template in the Templates list, the Notification Payload text box is automatically populated with a sample payload for the template. Review the sample payload in the Notification Payload text box.

    • You can send the sample payload without changing it.

    • You can edit the sample payload in the text box.

    • You can click Load to load a payload from a text or XML file.

    • You can click Save to save the XML text of the payload to use again later.

    The simulator does not validate the XML text of the payload.

  7. Send the push notification.

    Click Send to deliver the push notification to the selected app.

    The screen displays a message to indicate success or failure.

Sensors

Test how your app works on low-cost phones that don't have all the optional sensors or camera features by using the Sensors tab of the emulator's Additional Tools. This feature is useful if your app uses the camera or some of the phone's sensors, and you want your app to reach the largest possible market.

  • By default, all sensors are enabled in the Optional sensors list. Select or clear individual check boxes to enable or disable individual sensors.
  • After you change your selections, click Apply. Then you have to restart the emulator.
  • If you make changes, and then you switch tabs or close the Additional Tools window without clicking Apply, your changes are discarded.
  • Your settings are persisted between for the emulator session until you change them or reset them. If you capture a checkpoint, the settings are saved with the checkpoint. The settings are persisted only for the specific emulator that you're using - for example, Emulator 8.1 WVGA 4" 512MB.

Sensor options

You can enable or disable the following optional hardware sensors:

  • Ambient light sensor.
  • Front-facing camera.
  • Gyroscope.
  • Compass (magnetometer).
  • NFC.
  • Software buttons (only on some high-resolution emulator images).

For informational purposes, here is the list of required and optional hardware sensors and features for Windows Phone 8.1 devices.

Category

Sensor or feature

Required

Optional

Sensors

A-GNSS (location)

X

Accelerometer

X

Magnetometer (compass)

X

Ambient light sensor

X

Proximity sensor

X

Gyroscope

X

Camera

Rear-facing camera

X

Front-facing camera

X

Wireless

2/2.5G cellular radio

X

3G/4G cellular radio

X

Bluetooth

X

WiFi

802.11b/g

802.11a/n

FM radio

X

NFC

X

Connectors

microSD card slot

X

 

Camera options

You can enable or disable the optional front-facing camera by selecting or clearing the check box in the Optional sensors list.

You can also select one of the following camera profiles in the Camera dropdown list.

  • Windows Phone 8.0 camera.
  • Windows Phone 8.1 camera.

Here is the list of camera features supported by each of the profiles.

Feature Windows Phone 8.0 camera Windows Phone 8.1 camera
Resolution 640 x 480 (VGA) 640 x 480 (VGA) or better
Autofocus Yes Yes
Flash No Yes
Zoom 2x (digital or optical) 2x (digital or optical)
Video resolution 640 x 480 (VGA) 640 x 480 (VGA) or better
Preview resolution 640 x 480 (VGA) 640 x 480 (VGA)

 

Frame rate counters

Use the frame rate counters in Windows Phone emulator to monitor the performance of your running app.

Descriptions of the frame rate counters

The following table describes each frame rate counter.

Frame rate counter Description
Composition (Render) Thread Frame Rate (FPS) The rate at which the screen is updated.
User Interface Thread Frame Rate (FPS) The rate at which the UI thread is running.
Texture Memory Usage The video memory and system memory copies of textures being used in the app.
Surface Counter The number of explicit surfaces being passed to the GPU for processing.
Intermediate Surface Counter The number of implicit surfaces generated as a result of cached surfaces.
Screen Fill Rate Counter The number of pixels being painted per frame in terms of screens. A value of 1 represents the number of pixels in the current screen resolution – for example, 480 x 800 pixels.

 

Enabling and disabling the frame rate counters

You can enable or disable the display of the frame rate counters in your code. When you create a Windows Phone app project in Visual Studio, the following code to enable the frame rate counters is added by default in the file App.xaml.cs. To disable the frame rate counters, set EnableFrameRateCounter to false or comment out the line of code.

// Show graphics profiling information while debugging.
if (System.Diagnostics.Debugger.IsAttached)
{
    // Display the current frame rate counters.
    Application.Current.Host.Settings.EnableFrameRateCounter = true;

    // other code…
}
' Show graphics profiling information while debugging.
If System.Diagnostics.Debugger.IsAttached Then

    ' Display the current frame rate counters.
    Application.Current.Host.Settings.EnableFrameRateCounter = True

    ' other code...
End If

Run Windows Phone apps in the emulator