3

I would like to open my facebook page through my android app on click of a button. I am currently using the following code: [ as answered here: Open Facebook page from Android app? ]

public static Intent newFacebookIntent(PackageManager pm, String url) {
  Uri uri = Uri.parse(url);
  try {
    ApplicationInfo applicationInfo = pm.getApplicationInfo("com.facebook.katana", 0);
    if (applicationInfo.enabled) {
      // https://stackoverflow.com/a/24547437/1048340
      uri = Uri.parse("fb://facewebmodal/f?href=" + url);
    }
  } catch (PackageManager.NameNotFoundException ignored) {
  }
  return new Intent(Intent.ACTION_VIEW, uri);
}

I am able to load the page too in facebook app but, it just shows 'About' section, photos and recent posts. I cant see cover page or like button there. If I manually open facebook app (not through my android app), and visit my page everything displays fine, but problem comes up when i try to link facebook page with my app. Anyone has idea what am i doing wrong and why cant i see the like button? I've been trying to figure this out since 2 days but no luck! Thanks in advance

Community
  • 1
  • 1
Harry
  • 31
  • 4
  • Stuck in the same problem.. everything works fine but there is no like button and even contents are a bit different than what we normally see when opening our page directly thorough app – Arthas Feb 07 '17 at 09:54
  • close to 2020 now... anyone has a solution maybe? – adrianvintu Dec 14 '19 at 22:17
  • 1
    There are no Facebook APIs to open your page through deeplinks in the app. Earlier, facebook had few open deeplinks but they closed in the updates. So, there's no way it can be achieved currently, nor would you find it being done currently in any of the apps. – Neeraj Dwivedi Jan 28 '20 at 10:43

2 Answers2

0

this is 2022, I could open Facebook page using

Uri.parse("fb://page/{enter ID here}")

to get the page ID you can just try to send message to the page using messenger in web and the ID is shown plane in the link.

enter image description here

ghiath
  • 159
  • 11
0

Feb 2022, I got it to work using:

Uri.parse("fb://faceweb/f?href=" + url);

By the way, this works for pages and groups.

RLopez
  • 1