This topic has not yet been rated - Rate this topic

How to: Extend the Pictures Hub with App Connect for Windows Phone

Windows Phone

March 22, 2012

With App Connect, your application can be launched from the Pictures Hub, enabling a convenient launch experience for picture-related applications. This topic describes how to create an application that can be launched from the Pictures Hub. For more information about extending the pictures experience, see Pictures Extensibility Overview for Windows Phone.

Important noteImportant Note:

For this release of the Windows Phone SDK, this topic can be completed only on the device and not on Windows Phone Emulator. The current version of the emulator does not include access to the Pictures application on the device.

This topic is based on C# development; however, Visual Basic code is also provided.

In this section, you create the application and declare an extension for the Pictures Hub.

To declare a picture viewer extension

  1. In Visual Studio 2010 Express for Windows Phone, create a new project by selecting the File | New Project menu command.

  2. The New Project window is displayed. Expand the Visual C# templates, and then select the Silverlight for Windows Phone templates.

  3. Select the Windows Phone Application template. Fill in the Name box with a name of your choice. By default, this is the name that will appear on the apps pivot page in the Pictures Hub.

  4. Click OK. The New Windows Phone Application window is displayed.

  5. In the Target Windows Phone Version menu, ensure that Windows Phone 7.1 is selected.

  6. Click OK. A new project is created, and MainPage.xaml is opened in the Visual Studio designer window.

  7. Open the application manifest file, WMAppManifest.xml, and add the following code as a child to the App element, just after the Tokens element. This allows your application to be launched from the picture viewer.

    <Extensions>
          <Extension ExtensionName="Photos_Extra_Hub" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" />
    </Extensions>
    
    
  8. (optional) On MainPage.xaml, replace the StackPanel named TitlePanel with the following code. This step provides the application with a UI that will distinguish it from other applications.

            <!--TitlePanel contains the name of the application and page title-->
            <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
                <TextBlock 
                    x:Name="ApplicationTitle" Text="APP CONNECT EXAMPLE" 
                    Style="{StaticResource PhoneTextNormalStyle}"/>
                <TextBlock 
                    x:Name="PageTitle" Text="picture app" Margin="9,-7,0,0" 
                    Style="{StaticResource PhoneTextTitle1Style}"/>
            </StackPanel>
    

When the device is tethered to your computer, you cannot use the Pictures Hub. However, your device must be tethered to your computer to load your application. This procedure describes how you can transfer your application to the device and test it.

To test App Connect on the device

  1. With your device, take a picture using the camera.

  2. Tether your device to your computer and wait for it to be recognized by the Zune software. Ensure that the application is set to deploy to the Windows Phone Device, select Debug from the menu, and select Start Debugging. Once the application is visible, go back to the Debug menu and select Stop Debugging. Disconnect the device from your computer and navigate to the Start screen.

  3. On the Start screen, tap the Pictures application. This will open the Pictures Hub.

  4. From the Pictures Hub, swipe to the apps pivot page.

    Note Note:

    The apps pivot page will appear in the Pictures Hub only if one or more applications have declared the Pictures Hub extension.

  5. On the apps pivot page, choose the name of your application. This will launch your application.

From left to right, the following image shows how the application named Your Photo App can be launched from the apps pivot page of the Pictures Hub.

AP_Con_CameraPhotoHub

Did you find this helpful?
(1500 characters remaining)