简体   繁体   中英

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.

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 (ie 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}

Make Sure That You are Using the page id of your page correctly

Intent intent = new Intent(Intent.ACTION_VIEW, Uri
                                .parse("fb://page/YOUR PAGE ID"));
                        startActivity(intent);

i think u should use

https://www.facebook.com/ instead of fb://page/ or fb://profile or something. I hope it's helpful!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM