Thursday, June 12, 2014

Android: Open Facebook official app from your own app with different intents

Opening Facebook's official android app from your own app is really easy. You just need to create an intent with correct uri and start and activity with that intent. The app will open with the right page, group, picture, video or etc.

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);

where uri could be any of the following:

fb://root
fb://feed
fb://feed/{userID}
fb://profile
fb://profile/{userID}
fb://page/{id}
fb://group/{id}
fb://place/fw?pid={id}
fb://profile/{#user_id}/wall
fb://profile/{#user_id}/info
fb://profile/{#user_id}/photos
fb://profile/{#user_id}/mutualfriends
fb://profile/{#user_id}/friends
fb://profile/{#user_id}/fans
fb://search
fb://friends
fb://pages
fb://messaging
fb://messaging/{#user_id}
fb://online
fb://requests
fb://events
fb://places
fb://birthdays
fb://notes
fb://places
fb://groups
fb://notifications
fb://albums
fb://album/{%s}?owner={#%s}
fb://video/?href={href}

5 comments:

Marcos Campos said...

hi how to open intent from post in page facebook
example https://www.facebook.com/ZangadoGames/posts/1120441297984067

Agatha Bejan said...

What if someone who clicks on my link doesn't have the FB app on their phone? Currently they are redirected to a blank web page - is there any solution to that?

John Jacob said...

Thanks for Sharing such a good tip.Great job! now i can easily open Facebook Android apps on my phone.You can also Download Android Apps from here:
Free Crack Software |
Windows 10 Pro CD Key Crack Free Download

Software Download said...

Thanks for providing such a useful guide.Its very helpful for all Android user's.
You can also Download Android Apps For Samsung Galaxy click here:
Free Download Software Full Version |
Samsung Smart Camera App Free Download

Abbeygail said...

Thanks for sharing this. It is a very useful guide.
https://www.myoptimind.com/mobile-application-development-services/