How can I launch a facebook app from my app in android?
-
do you just want to launch the app or a certain activity? – Patrick Boos Nov 16 '10 at 06:08
5 Answers
Looking at the latest Facebook apk (1.6), it looks like both "facebook://" and "fb://" are registered protocols.
facebook://
facebook:/chat
facebook:/events
facebook:/friends
facebook:/inbox
facebook:/info
facebook:/newsfeed
facebook:/places
facebook:/requests
facebook:/wall
fb://
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}
fb://post/{postid}?owner={uid}¹
Sorry if I missed some... only played with a handful of them in the emulator to see if they actually work - a bunch of them will cause the Facebook application to crash.
¹ where postid is in the uid_postid
format, e.g 11204705797_10100412949637447

- 13,136
- 12
- 63
- 80
-
Was just about to fiddle around for this. Thank you. I can confirm that these work. – Oct 19 '11 at 11:47
-
@NPike is there anyway to link directly to a photo? I have the uid and a http link with the "photoid". – Anders Metnik Jun 21 '12 at 07:49
-
8Has this been documented anywhere? I tried to search it but couldn't find it anywhere. So it is possible that someday this breaks our app too isn't it? – Sudarshan Bhat Sep 24 '12 at 11:16
-
1
-
3how can i open a group? i tried but not succeeded fb://groups/{group_id} – Muhammad Aamir Ali Jun 21 '13 at 11:44
-
This usually work, but for some reason, if you go to the app info screen of facebook app, and choose "force stop", running the intent would cause facebook to crash. has anyone else got this behavior too? – android developer Oct 10 '13 at 12:59
-
For facebook is 'facebook://' or 'fb://' for google play is 'market://' where can I get this info for every possible app @NPike ? – code4jhon Jul 26 '14 at 17:08
-
3Has this been documented anywhere? I'd like to read about it in detail. – Sergey Dirin Dec 28 '14 at 10:22
-
6Sorry it seems to be not working with Facebook update 25.0.0.19.30 – Shaik Khader Jan 27 '15 at 12:27
-
Nice answer..but it sometimes crash..I want to know guide document.I'm trying that facebook apk is launched from my app and get newsfeed text.If someone found latest guide, pass link to me.. – lynndragon Sep 28 '15 at 13:14
To just start the default Launcher Activity:
Intent intent = new Intent("android.intent.category.LAUNCHER");
intent.setClassName("com.facebook.katana", "com.facebook.katana.LoginActivity");
startActivity(intent);
I did some research, because I wanted to find this out :). I found some ways how to start different activities easily. But I can not guarantee that this will work after upgrades of facebook. I tested it with my current facebook app and it works. At least I tested it with "adb shell" using "am start .....".
Basic is:
String uri = "facebook://facebook.com/inbox";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
the facebook.com part is not checked. you can even type: "facebook://gugus.com/inbox" having the same effect.
How to do this in adb.
1. Start adb shell through console: "adb shell"
2. run: "am start -a android.intent.action.VIEW -d facebook://facebook.com/inbox"
this will start the inbox activity. Here some Uris with examples. I think they speak for themselves what they do.
facebook://facebook.com/inbox
facebook://facebook.com/info?user=544410940 (id of the user. "patrick.boos" won't work)
facebook://facebook.com/wall
facebook://facebook.com/wall?user=544410940 (will only show the info if you have added it as friend. otherwise redirects to another activity)
facebook://facebook.com/notifications
facebook://facebook.com/photos
facebook://facebook.com/album
facebook://facebook.com/photo
facebook://facebook.com/newsfeed
there might be additianl parameters you can give to certain of those uris, but I have no time to go through all the code of those activities.
How did I do this? check out apktool.

- 6,789
- 3
- 35
- 36
-
1It seems like this doesnt work anymore ( and it definitely used to!). facebook://facebook.com/wall?user=1230123 just opens Facebook to the Stream activity, and not the wall of the specified user. – NPike Jul 09 '11 at 23:33
-
1
-
Hello Patrick: Here it opens up the installed facebook app, But i need to open the facebook app with the update status opened along with the image attached to the status , how to achieve this ...? any help is greatly appreciated ... – Rajesh Rs Jan 19 '12 at 12:20
-
sorry.. i guess those were from a older version. check out @NPike's post. Those might be the ones you need :) – Patrick Boos Jan 20 '12 at 01:19
-
2
-
than of course it won't work. What I do is first check if facebook app is installed (through PackageManager) and if it is installed, do the above, if not, open the website. – Patrick Boos Jan 26 '12 at 22:45
-
-
1try{...} catch(...) { ... } ;-) or check if the app is installed before doing the above. – Patrick Boos Apr 04 '12 at 01:29
-
@PatrickBoos I am viewing the Facebook app source code. Which part of the source code are you looking at to find the URI information? – babysnow Nov 08 '12 at 06:42
-
@CaptainObvious don't remember :) But first look at the AndroidManifest.xml to see which Activity gets started for the urls. And in there you than see the rest. – Patrick Boos Nov 08 '12 at 10:12
If any one want to directly open a photo
public Intent getOpenFacebookIntent(String pId) {
try {
activity.getPackageManager().getPackageInfo("com.facebook.katana", 0);
return new Intent(Intent.ACTION_VIEW, Uri.parse("facebook:/photos?album=0&photo=" + pId + "&user=" + ownerId));
} catch (Exception e) {
return new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/"));
}
}
startActivity(getOpenFacebookIntent(pid));
where ownerId
is the Facebook id
of the user who uploaded this picture and pid
is PhotoId
Enjoy :))
-
It doesn't work for me. There's a separate question where this answer is quoted (http://stackoverflow.com/questions/36251372/how-to-open-a-specific-album-or-photo-in-facebook-app-using-intent-from-your-own) and it doesn't work for other people either. – Bartek Jan 13 '17 at 14:34
-
Hi @Bartek This answer is way too old. That time it was working. There are so many changes in facebook app iteself. May be this won't work now. Apologies for that. – Sunny Jan 16 '17 at 07:44
Launching of another application from your application in android, can be done only if Intent action you fire matches with intent filter of other application you want to launch.
As @patrick demonstrated, download facebook.apk to emulator and try to run that through adb shell command. It works fine..
Pass Intent filter and data as an Uri

- 3,590
- 5
- 33
- 40
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/groups/14531755***6215/")));
This directly opens facebook group having the id: 14531755***6215 inside fb app

- 507
- 3
- 12