One of the easiest ways to integrate deeper into Windows 8 or Windows Phone 8 is to implement share target part of the share contract. Share target means when someone taps on the share charm in Windows, or a share menu from the phone. Your app could be the item they could share to.

The first thing you need to do is declare your intention to be a participant by opening up the package.appxmanifiest file and selecting the declarations tab.From the Available Declarations drop down, select Share target.

packageAppxManifest

You then can select which kinds of file formats and file types your app will support. This will limit your app to only show up when it can actually handle the type of information being shared. In this case, I only am declaring support for URIs.

In the App.xaml.cs file, you then need to override the OnShareTargetActivated method. here is some sample code I came up with to extract the shared URI and pass the data on the main page.

Then, in your main page, simply detect when you are getting a URI and do something with it in your OnNavigatedTo override!

 

Leave a Reply
Your email address will not be published.
  • ( will not be published )