With Windows Phone OS 7.1, apps can use App Connect to extend the Search experience on Windows Phone. With App Connect, users that search the web with the Search button can launch your app from Bing search results. This sample is a fictitious product recall app for baby, nursery, and toy products. Launch this app from the apps pivot page of a quick card after searching for products like “baby doll stroller” and “baby bottle”. For more information, see Search extensibility for Windows Phone.

You need to install Windows Phone SDK 7.1 to run this sample. To get started, go to the Windows Phone Dev Center.

To run the sample

  1. Double-click the .sln file to open the solution.

  2. Press F5 to start debugging the app. When the app launches for the first time, the main page will appear with instructions about how to use the sample with the device. These instructions are described in the following steps.

  3. Press the Start button to navigate to Start.

  4. Press the Search button to navigate to Bing.

  5. Tap the Search box and enter a baby, nursery, or toy search term such as “baby doll stroller” or “baby bottle”. Then tap Go to initiate the search.

  6. After the search results are displayed, scroll the Web pivot page to the Products list. Each item displayed under Products is a product card that represents a product.

  7. Tap a product in the Products list. This will launch the product card for the selected product.

  8. The product card will show four pivot pages related to the selected product: about, review, prices, and apps. Swipe to the apps pivot page.

  9. On the apps pivot page, the sample app appears as an app named Trey Research Product Recalls. Tap it to launch the app item page.

  10. On the app item page, the name of the product appears and below that, a randomly generated message that the product has or has not been recalled.

Windows Phone Emulator in Windows Phone SDK 7.1 breaks from the debugging process when an app is relaunched. To debug a launch of the app via App Connect, you need to simulate the navigation URI. To do this, temporarily edit the DefaultTask element in your app manifest file, WMAppManifest.xml, as described in the following steps.

To debug search extensibility on Windows Phone Emulator

  1. In Solution Explorer, expand Properties and double-click WMAppManifest.xml.

  2. In the Tasks element, find the DefaultTask element and comment-out the line of code as shown in the following example.

     
    <!--<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />-->
  3. Add a temporary DefaultTask element to the Tasks element that simulates a launch from a Search Extras deep link URI. You can un-comment one of the sample DefaultTask elements that are provided in the sample or create your own. For example, the following shows code that simulates an App Connect launch for a product named “Baby Bottle”.

     
    <DefaultTask Name="_default" NavigationPage="SearchExtras?ProductName=Baby Bottle&amp;Category=Bing_Products_Baby_and_Nursery" />
  4. Select Windows Phone Emulator in the Select Target drop-down menu on the Visual Studio toolbar.

  5. Press F5 to start debugging the app. The app will launch to the app item page as though you had tapped the app in the apps pivot page of the corresponding product card.

  6. On the app item page, the name of the product will appear and below that, a randomly generated message that the product has or has not been recalled.

  7. When you are finished debugging the app with Windows Phone Emulator, comment-out the temporary DefaultTask element and un-comment the original DefaultTask element that is shown in the following example.

     
    <DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
Note:

This sample is packaged as a Windows Phone 7.5 project. It can be converted to a Windows Phone 8 project, by changing the target Windows Phone OS version of the project. To create a Windows Phone 8 project, you must be running the Windows Phone SDK 8.0 on Visual Studio 2012. You can download the latest version of the SDK from http://dev.windowsphone.com/downloadsdk.

To convert the sample to a Windows Phone 8 project:

  1. Double-click the .sln file to open the solution in Visual Studio.

  2. Right-click the project in the Solution Explorer and select Properties. This opens the Project Properties window.

  3. In the Application tab of the Project Properties window, select Windows Phone OS 8.0 from the Target Windows Phone OS Version dropdown. A dialog will appear asking if you want to upgrade this project to Windows Phone OS 8.0.

  4. Select Yes to upgrade the project.