Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Facebook page via Facebook app

How can I open Facebook page using insalled Facebook app? Exactly page, not profile, because fb://profile works fine.

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/page_id")));

Seems like fb://page isn't working, because it's just opens feed.

like image 269
Geralt_Encore Avatar asked Dec 26 '22 17:12

Geralt_Encore


1 Answers

fb://page/{id} is the way to go:

final String url = "fb://page/" + facebookID
Intent facebookAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
facebookAppIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(facebookAppIntent);

Are you sure you are using the ID number of your Facebook page and NOT the username?

What I mean is that if, for example, you want to open the Facebook page of Facebook itself (i.e. https://www.facebook.com/facebook) you have to use:

fb://page/20531316728

Since 20531316728 is the ID of the Facebook page (while facebook is the username).

If you don't know the ID of your Facebook page, you can retrieve it opening:

https://graph.facebook.com/{username}
like image 159
Paolo Rovelli Avatar answered Dec 31 '22 12:12

Paolo Rovelli