4

I need to launch the WP8 facebook app on a certain page, from my code behind, and if the app is not installed open the browser on that page:

right now i'm doing this:

var success = await Windows.System.Launcher.LaunchUriAsync(new Uri("fb://page/313689422066566"));

and I use success to try open the browser.

the app launches but it show my wall instead of the page, and if the app is not installet the phone ask me to search on the store in search of an app...

anyone can tell how to do this or where i can find some info?

thanks

jack_the_beast
  • 1,838
  • 4
  • 34
  • 67

2 Answers2

3

Hey actually there's an undocumented (I found this by trial and error starting from this question) way to do this.

Launcher.LaunchUriAsync(new Uri("fb:pages?id=YOUR_PAGE_ID"));
Community
  • 1
  • 1
Fabio Marcolini
  • 2,315
  • 2
  • 24
  • 30
  • That is that I was looking! I don't know why this stuff is undocumented – Gidrek Nov 12 '14 at 15:41
  • Does it work on a Windows Phone 8 (not updated to 8.1) device? I'm currently testing with and 8.1 emulator, but our app which will use this kind of function supports WP8 still. As I read the API doc for `Launcher.LaunchUriAsync` method, it says "Not implemented in Windows Phone" – patrickjason91 Dec 09 '14 at 10:06
  • @patrickjason91 could you point where you read "Not implemented in Windows phone"? Looking here http://msdn.microsoft.com/en-us/library/windows/apps/hh701480.aspx at the bottom it says minimum supported phone Windows phone 8. The method overload that has options is supported by windows phone 8.1, anyway I use it for an app for Wp8 (silverlight 8.0) and it works. Only problem I remember the method return always true whether the uri was handled by an app or not... – Fabio Marcolini Dec 10 '14 at 06:56
  • Already used it, yeah my bad, i saw the other overload with options. Yes, i think that's the problem, the method return. Sadly it doesn't return anything but true, which in our app, if Facebook app doesn't exist, then webview should open instead to open FB page. – patrickjason91 Dec 11 '14 at 12:47
  • How do you do this in Windows 10 API (UWP)? It was working for me this way for a while, but since I don't know how many updates to W10M, it stopped working. Thanks – robcsi Oct 03 '16 at 08:53
  • @robcsi Sorry I don't know, never had to migrate the app to windows 10 – Fabio Marcolini Oct 03 '16 at 13:39
0

What you're asking to do is not possible.

First, I don't believe it's possible to open the Facebook app to a specific page. I know you can use the fb: URI scheme to open the app and can even use fb:post?text=foo to start a new post, but I don't believe you can open a page.

Even if you could, the way URI schemes work in Windows Phone is that if the URI scheme is registered, it opens the app. If it's not registered, it asks you to install the app from the store. There's no way to send them to a web site instead that I know of.