Integrating with the Me card in a Windows Phone Silverlight 8.1 app

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

Supporting post update

With the post update feature, an app user posts an update to your app’s web service from the Me card. The update then posts to the user’s social network in a broadcast-style communication. This feature is not intended to be used for targeted communication, such as private messages, or to publish info to a handful of individuals rather than to the user’s broader social network. Use this feature only if your app supports updates to a social network.

To be included in the list of apps that appear when the user taps post an update on the Me card, you must include the following extension in your WMAppManifest.xml file.

<Extension ExtensionName="People_Me_Publish" ConsumerID="{bedab396-3404-490c-822e-13309c687e97}" TaskID="_default" />

An app launches from the post an update list through a deep link that contains the query string parameter action with the value Post_Update. Your app should check for this parameter when it launches. If the parameter is found, your app should display a UI in which the user can directly post an update. You should not display your app’s standard launch UI, and the user should not be required to navigate to the post update experience.

Your app’s post update experience should offer as many types of rich content as your network supports. For example, if users on your network can generally attach a picture, tag friends, or add other media to an update, the experience when your app launches from the Me card should also support these forms of sharing.

Supporting location check-in

In the location check-in feature, an app user can make a location-based check-in to your app’s web service from the Me card. The check-in then posts to the user’s social network. To include your app in the list of apps displayed when the user taps check in on the Me card, you must include the following extension in your WMAppManifest.xml file.

<Extension ExtensionName="People_Me_CheckIn" ConsumerID="{bedab396-3404-490c-822e-13309c687e97}" TaskID="_default" />

An app launches from the check in list through a deep link that contains the query string parameter action with the value Check_In. Your app should check for this parameter when it launches. If the parameter is found, your app should display a UI in which the user can directly post a location check-in. You should not display your app’s standard launch UI, and the user should not be required to navigate to the check-in experience.

This feature should not be used for any purpose other than location-based check-in.

Example Uri mapper for post update and location check-in

When the system launches your app from the Me card so the user can post an update or check in using your app, this is indicated in the query string parameters of the Uri used to launch your app. A common way to handle navigating to different pages based on query string parameters on the launch Uri is to implement a UriMapper. The following example shows how to redirect the navigation if the post update or check-in query string parameters are present. Add this class definition to your App.xaml.cs file.

class AssociationUriMapper : UriMapperBase
{
    public override Uri MapUri(Uri uri)
    {
        string uriAsString = uri.ToString();

        if (uriAsString.Contains("action=Post_Update"))
        {
            // keep the parameters and send to MainPage.xaml
            return new Uri("/PostUpdate.xaml", UriKind.Relative);
        }
        if (uriAsString.Contains("action=Check_In"))
        {
            // keep the parameters and send to MainPage.xaml
            return new Uri("/CheckIn.xaml", UriKind.Relative);
        }

        return uri;
    }
}

You need to register the UriMapper with the app for the Uri mapping code to be called during navigation. Add the following line to the InitializePhoneApplication method in your App.xaml.cs file.

RootFrame.UriMapper = new AssociationUriMapper();