Social features of Sweepy Cleaner

I’ve just implemented two social features in my Sweepy Cleaner game. I’m gunna help you add these simple features in C# XNA.

The first is ‘rate & review’ which can be accessed via the About screen in Settings. This allows the user to, as the name suggests, rate and review the App on Windows Phone marketplace. It’s simply:

MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask();
marketplaceReviewTask.Show();

More information can be found here. I have placed this in the ‘Guide’ or pop-up menu area of Windows Phone. To do this:

Guide.BeginShowMessageBox("HEADER TEXT", "MAIN TEXT",

new List<string> { "Ok", "Rate & Review" }, 0, MessageBoxIcon.None, new AsyncCallback(reviewApp), null);

Then when a button is pressed it calls the ‘reviewApp’ method:

private static void reviewApp(IAsyncResult asyncResult)
{
  int? returned = Guide.EndShowMessageBox(asyncResult);
  if (returned == 1) // 1 is the 'rate & review' button, 0 is the 'ok' button
  {
    // Sends user to Marketplace to review the App
    MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask();
    marketplaceReviewTask.Show();
  }
}

‘Returned’ does not have to be tested for 0 as the Guide sends you back to your game if no code has been written to handle the ‘returned’ value.

The second feature is ‘Share’ which is available on the Game Over screen. This allows you to post your score and a link to the game on a social media site like Facebook, Twitter etc.

ShareLinkTask shareLinkTask = new ShareLinkTask();
shareLinkTask.Title = "TITLE TEXT HERE";
shareLinkTask.LinkUri = new Uri("URL HERE", UriKind.Absolute);
shareLinkTask.Message = "COMMENT TO SHARE HERE";
shareLinkTask.Show();

More info here. In my case, I’m using a link to the app on the marketplace. Obviously it appears that this cannot be done as the app isn’t up on the marketplace, your linking to something that doesn’t exist. However, the deep links that send you to the marketplace page is based on your unique GUID. It is formatted like this, where {GUID} is your GUID code:

https://windowsphone.com/s?appId={GUID}

This is really useful to get a link to your app that hasn’t been released yet, except the only way to really test it is to have your app published in the marketplace :D

Your GUID can be found in the AssembleyInfo.cs as the GUID, or in WMAppManifest.xml as the Product ID.

Happy coding!

Rob