Udostępnij za pośrednictwem


How to determine app capabilities 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 to verify the capabilities required by an app that targets Windows Phone OS 7.1. Capabilities include the use of networking, the location sensor, or the camera. You can use the Windows Phone Store Test Kit to verify the capabilities required by apps that target Windows Phone OS 7.1.

Windows Phone implements a capabilities-driven security model that requires a user to consent to certain functionality within the app. When the user installs an app, the Windows Phone operating system discloses the app’s functionality to the user and requests the user’s consent based on the capabilities listed in the app manifest file. In certain scenarios, the Windows Phone APIs that are associated with capabilities won’t run without the user’s consent.

You have to specify the capabilities that your app requires in the app manifest file, WMAppManifest.xml. If you do not accurately specify the capabilities, your app might not work correctly.

By default, when you create a Windows Phone project, the app manifest file includes a subset of the capabilities supported by Windows Phone. For the full list of capabilities and their descriptions, see App capabilities and hardware requirements for Windows Phone 8.

This topic contains the following sections.

 

Using the Store Test Kit to determine capabilities for apps that target Windows Phone OS 7.1

You can use the Capability Validation test in the Windows Phone Store Test Kit to detect the specific capabilities required by an app that targets Windows Phone OS 7.1. The Windows Phone Store Test Kit is a suite of tests with which you can evaluate your app for Windows Phone Store readiness. The Windows Phone Store Test Kit contains a Capability Validation test that runs as part of its automated test suite for apps that target Windows Phone OS 7.1. For more information about the Windows Phone Store Test Kit, see Windows Phone Store Test Kit for Windows Phone 8.

If you want to view the rules that are applied by the Capability Validation test for evaluating the capabilities that an app uses, they are in a file named Rules.xml that you can find at one of the following locations.

  • Program Files\Microsoft SDKs\Windows Phone\v7.1\Tools\Marketplace

  • Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\Marketplace

To use the Windows Phone Store Test Kit to determine capabilities for an app that targets Windows Phone OS 7.1 

  1. In Visual Studio, create a release build of the Windows Phone OS 7.1 app that you want to test. For information about how to create a release build, see How to build an app for Windows Phone 8.

  2. In Solution Explorer, select the start-up project and on the Project menu, choose the Open Marketplace Test Kit option. The Windows Phone Store Test Kit opens.

  3. Click the Automated Tests tab, and then click Run Tests. This will run all the automated tests on your app, including the Capability Validation test.

Note

If you have not specified art or screenshots for your app, you should expect the related tests to fail. These test results are not relevant to the capability results.

  1. View the Result Details column of the Capability Validation test. Each capability identified in this column starts with ID_CAP. The following is an example results from running the Capability Validation test. ID_CAP_NETWORKING is the only capability listed in this example.

    [INFORMATION]: Capabilities used by application: ID_CAP_NETWORKING
    
  2. In Solution Explorer, open WMAppManifest.xml. Select all the capabilities that are listed in the Result Details column of the Capability Validation test, and clear all the capabilities that are not listed. For the example result in the previous step, you would clear all of the capabilities except networking (ID_CAP_NETWORKING). For information about editing the app manifest file, see How to modify the app manifest file for Windows Phone 8.

  3. Build, test, and deploy your app with the capabilities identified by the tool.

Capabilities detection during submission of apps that target Windows Phone OS 7.1 

When you submit an app that targets Windows Phone OS 7.1 to the Store, the capabilities of the app are programmatically analyzed to detect the capabilities required by the app. The app submission process replaces the capabilities list, whether it is the auto-generated list or a list that you have modified, with the specific capabilities required for your app. This means that if the app manifest submitted with the app does not contain capabilities that are used by your app, these capabilities are added as part of the submission process.

There are some exceptions for capabilities that are added or modified during submission. The following table describes these exceptions.

Capability

Description of exception

ID_CAP_NETWORKING

Added to manifest if capability is detected.

Not removed if present in the manifest file at submission.

ID_HW_FRONTCAMERA

Added to manifest if capability is detected.

Not removed if present in the manifest file at submission.

ID_CAP_IDENTITY_DEVICE

Added to manifest if capability is already present in manifest and use of DeviceExtendedProperties is detected.

Not added to manifest if capability is not already present in manifest, even if use of DeviceExtendedProperties is detected.

Capabilities detection for apps that target Windows Phone 8 

For apps that target Windows Phone 8, it’s important to identify the required capabilities and add them to the app manifest file. For more info about capabilities, see App capabilities and hardware requirements for Windows Phone 8. For more info about modifying the manifest file, see How to modify the app manifest file for Windows Phone 8.

The Windows Phone SDK 8.0 does not contain tools to detect the capabilities required for apps that target Windows Phone 8.

When you submit an app that targets Windows Phone 8 to the Store, capabilities are not analyzed and the app manifest file is not regenerated or corrected.

See Also

Other Resources

App manifest file for Windows Phone 8