Skip to content

Using the ShareLinkTask of Windows Phone 7.5 (Mango)

September 26, 2011

One of the must-have features of your app is “Share”. It can be by email but nowadays it’s more likely to be on Facebook, Twitter etc.. So as a developer you have to find the right library or at worst code the entire process. I say “process” because it’s not only the sharing experience, it’s the setup, the storage and the management of the third-party credentials. If you are lucky you will find a somewhat easy to use library. If not you are going to have nightmares about OAuth and the integration of the WebBrowser control in your app.

But there’s another solution: use the new ShareLinkTask (or ShareStatusTask) from the Windows Phone SDK. Since the user can link his/her Facebook, Twitter, Live or LinkedIn accounts on his/her device, your application can benefit from it. The code is trivial, here’s a sample for sharing a bookmark in Stacks for Instapaper:

var sharetask = new ShareLinkTask();
sharetask.LinkUri = link;
sharetask.Message = message;
sharetask.Title = title;
sharetask.Show();

And the screen displayed by the OS to the user:

sharescreen

In my application I was able to:

  • remove a library (Facebook)
  • remove some classes to manage the Twitter authentication workflow
  • simplify the Settings page by removing the social networks preferences

Less code and more features, isn’t that cool?

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: