Friday, July 1, 2011
Windows Phone AppConnect Bing search extensibility (Apps aka Extras)
A couple of days ago the Mango Beta 2 SDK, aka Windows Phone 7.1, was released, along with a pre-release test version of the device OS. There were some great additions to the Beta 1 feature set, which I’ll be discussing over my next posts – stay tuned.
Today I want to focus on Bing integration in Windows Phone, also known as search extensibility, search extras, and officially now, AppConnect. What is that anyway ? AppConnect lets your app appear with relevant Bing search results on the phone.
Some Bing searches return what’s called “Quick Cards” in additional to traditional web results. There are Product, Place, and Movie Quick Cards, which contain detailed information about the item, such as descriptions, images, reviews, and prices. Quick Cards also contain an additional ‘Apps’ section that lists marketplace Windows Phone apps that are related to the card’s product, place or movie.
So if the user is doing a search on the phone for a specific product, place or movie, and a Quick Card comes up in the search results, and the quick card is in one of the Bing categories that you’ve associated with your app, then your app will appear listed in the Apps section of the Quick Card (formerly called the ‘Extras’ section, hence the extras term above). Of course, your application needs to be in the marketplace for this to happen.
If the user taps on your app’s title, if the app is already installed on the phone s/he will get taken to the specific page you configured in your app, and the Bing search parameters will be passed to the app – more on that later. If the app is not installed, the user will be able to download it from the marketplace.
The next question is, how do we set up our application so it’ll show up in relevant Bing searches ? The process is fairly simple :
1) Add some ‘extension’ elements to your app’s WMAppManifest.xml file to specify relevant Bing categories
2) Create an Extras.xml file that maps Bing categories to titles and descriptions that you want to be displayed in the Apps tab of the Bing quick card
3) Optionally, create a landing page in your app to retrieve the query string parameters passed from the Bing quik card when the user launches your app from that card
Configuring extension elements
You add an <extensions> element under the <app> element of the WMAppManifest file, and within it, as many <extension> elements as you want to specify the Bing categories your app should be associated with in searches, such as :
The list of possible extension names can be found here :
The value of ConsumerID is fixed and indicates this is a Bing search extension.
ExtraFile specifies the location of the Extras.xml file.
In the beta release, to be able to test your app in the emulator, you should also add the beta extensions, in this case :
This won’t be required in the release version of Windows Phone 7.5.
Create the extras file
The extras.xml file contains mapping between Bing categories or groups of categories, and strings you want to appear in the quick card to describe your app :
In addition to specifying the app title that should appear in the quick card, you add one or more ExtensionInfo elements that each specify a caption to display for if the associated Bing categories are hit. For example, you may want the quick card to display “Kiteboarding equipment” if the search result is in the Bing Products Sports & Outoors category, and “Kiteboarding travel” if in the Bing Products Travel category.
Create a landing page
For a better user experience you may want the user to be taken to a specific page if s/he taps on your app title in the Apps tab of the quick card. To do that, create a landing page and retrieve and parse the Bing parameters which are automatically passed to the page when launched from the Bing quick card. These parameters are ProductName and Category for a product card, MovieName and Category for a movie card, and PlaceName, PlaceLatitude, PlaceLongitude, PlaceAddress and Category for a place card :
Your application can then perform some logic based on these passed parameters, such as retrieving the product, movie or place from a database and displaying some data.
Testing the app
Now I’ve found that testing these features can sometimes be tricky as it involves working with Bing searches. For this example, I’ll assume you’ve included the Bing_Products_Sports_and_Outdoors category in your list of extensions. If you use the emulator, remember to include the ‘Products’ beta extension as well.
First, deploy and run your app to the emulator or device, and then press the Search button to start a Bing search. Now type “sporting goods” as a search phrase. At the top of the search results, you should see at least one Product card being displayed, above the Web heading.
Click on that card to enter the quik card. If everything is configured correctly, the card should have an Extras pivot with your app title displayed in it. Tapping on the title, should launch your app and take you to the landing page.
To test movies and places, you need to either have location enabled on your device, or if not, to specify a location in your search phrase, such as ‘movies Pittsburgh’ or ‘Starbucks New Orleans’. Remember, searches for places and movies are ‘local’ searches.
This example assumes you’ve included the ‘Places’ and ‘Movies’ beta extensions in you manifest file as well as ‘Products’ - you’d also need to add production Bing categories before submitting your app to the marketplace.
To test places, once the search results are displayed, bring up the Local pivot, and then select one of the places listed below the map. That will bring up the place quick card, and you can then flip to the App pivot of the card to see your app.
Tapping the app name will launch your app, but in this version, that will have the effect of detaching from the debugger.
Again, make sure both the beta extensions and relevant Bing extensions are specified in your manifest. Also make sure the extensions are mapped in the extras.xml file.
To search for a movie, you can search for something like “movies Philadelphia” (unless you’re using a device with location enabled, and you’re located somewhere in the US for example, in which case you can just type ‘movies’ or a movie name). Then click on the ‘Movies near Philadelphia PA’ section above the Web heading, and you’ll see a list of movies. Selecting a movie will open a movie card, and you can then flip to the App pivot.
Again, make sure you list and map both the ‘Movies’ beta extension and the ‘Bing_Movies’ single production extension for movies.
So to recap, using AppConnect you can easily make your app stand out by making it more discoverable through Bing searches, thus providing the user with a richer experience on the phone.