3

I wonder how to open the official Facebook App for sharing an URI from my C# code on Windows Phone. The common Uri-Scheme like "fb://" may open the App but no parameter seems to work. I have something like this in mind, but it will not work for me:

LaunchUriAsync(new Uri("fb://publish/profile/me?text=foo"));

Of course I know that I could use the ShareTask but that's not what I want. You can take a look at the Spotfy App, it does exactly, what I want to do, when sharing a song.

Thank you for your help and answers!

PS: Same with Twitter by the way...

Robin-Manuel Thiel
  • 2,206
  • 19
  • 26

2 Answers2

6

I finally solved it! It took me nearly two days to find the solution and it is not documented anywhere sothat I would like to share my results with you:

// Open official Facebook app for sharing
await Windows.System.Launcher.LaunchUriAsync(new Uri("fb:post?text=foo"));

I think this is a very cool feature and reminds users of how it works on other plarforms.

In conclusion launching other apps from your app via URI schemes is always a great scenario with a nice user experience.

Hint: Opening the official Facebook App via URI schemes requires at least version 4.1!

Robin-Manuel Thiel
  • 2,206
  • 19
  • 26
  • This looks really cool. Have you figured out if other apps like Twitter an Foursquare etc also have custom URI schemes? – Uzair Sajid Oct 31 '13 at 07:16
  • Twitter and Spotify for example do have those schemes. Unfortunately they are nearly completely undocumented which makes it really hard to implement them. – Robin-Manuel Thiel Oct 31 '13 at 10:58
  • Thanks for this, Please also share twitter if you ever find it! – ARH May 20 '14 at 07:11
  • Hi, This is good solution to open facebook app. In my case i need to check weather facebook app is installed or not. In this solution If fb not installed i'm getting popup message. Is there any to check condition installed or not?? – Jeeva123 Nov 25 '14 at 06:16
  • 1
    hi! Do you have a link where I can find all the parameters for this link. I'd like to share a link from my app. Thanks – Daniel Jan 16 '16 at 10:51
-3

If you wanna share the link, you can use ShareLinkTask

ShareLinkTask shareLinkTask = new ShareLinkTask();
shareLinkTask.Title = "My Title";
shareLinkTask.LinkUri = new Uri("http://fb.me/profile.php", UriKind.Absolute);
shareLinkTask.Message = "Yep. I can share a link on facebook.";
shareLinkTask.Show();

When user calls this method, it will show the sharable social networking apps installed on the phone, so you can share a link on the facebook, twitter & etc (if installed)

If you wanna share the local media file, you can use ShareMediaTask

Mohamed Thaufeeq
  • 1,667
  • 1
  • 13
  • 34
  • Thanks for the answer, but as I mentioned using the `ShareTask` or `ShareLinkTask` is not what I want to do. I wish to open the official Facebook App by using `LaunchUriAsync(new Uri("fb://publish/profile/me?text=foo"));` and post the status there. So it is done on all other platforms and WP8 is able to perform that, too. Spotify App does this... – Robin-Manuel Thiel Oct 14 '13 at 08:28