Using the ShareLinkTask of Windows Phone 7.5 (Mango)
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:
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?