1

I am trying to open the Facebook app from inside my app using an intent. I am using codename one to create my app and I am trying to link to a facebook group.

My current code is as follows:

Boolean canUseIntent = Display.getInstance().canExecute("fb://group/{id}");
if(canUseIntent != null && canUseIntent) {
   Display.getInstance().execute("fb://group/{id}");
} else {
   Display.getInstance().execute({url});
}

I get the group id using the Graph API explorer and I have tried more than one group.

The problem I am getting is that it opens the app fine but then displays a message saying it can't find the page.

In my attempt to get it to work I have also used fb://page/{id}, fb://groups/{id}, fb://feed/{id} and fb://facewebmodal/f?href=url.

Can anyone make any suggestions as to what I am doing wrong?

Thanks.

Kieran Jennings
  • 321
  • 2
  • 12
  • I'm assuming `{id}` is replaced with the id of the group e.g. `fb://group/3454436`. On which device are you seeing this? Notice that `canUseIntent` can be null in which case we just don't know. – Shai Almog Feb 04 '18 at 05:07
  • Yes, id is replaced with the group id. I’m seeing this on an iOS device. – Kieran Jennings Feb 04 '18 at 11:02
  • @ShaiAlmog should the canUseIntent != null handle the scenario where it is null? If it is null it should just open in a browser? – Kieran Jennings Feb 04 '18 at 11:05
  • If it's `null` it means we "don't know" which means it might work and might fail and it's up to you to decide. Whether we decide to do the execute or not varies on a case by case basis but you should know whether it returns true/false or null as it's a nuanced behavior. I'm not a big expert on Facebook but is this a group you have permissions to see? – Shai Almog Feb 05 '18 at 04:58
  • @ShaiAlmog I’m not sure I’m understanding correctly, sorry. If it is null it should never even try open the Facebook app it should just default to opening in a browser. It should only try opening the Facebook app if canUseIntent == true. I tried this with two groups, one I’m a member of and one I’m an admin of and neither worked. – Kieran Jennings Feb 05 '18 at 06:10
  • If it's null I would try the browser since the browser will be intercepted on Android and the facebook app will be used if it's installed. Looking at this answer it seems they broke the URL scheme several times https://stackoverflow.com/questions/5707722/what-are-all-the-custom-url-schemes-supported-by-the-facebook-iphone-app I'm not sure if that URL will work properly although it looks like it should. Make sure you are using the Facebook ID and not the token! – Shai Almog Feb 06 '18 at 05:01

0 Answers0