[ACCEPTED]-launch facebook app from other app-android
Looking at the latest Facebook apk (1.6), it 6 looks like both "facebook://" and 5 "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 4 if I missed some... only played with a handful 3 of them in the emulator to see if they actually 2 work - a bunch of them will cause the Facebook 1 application to crash.
¹ where postid is in the uid_postid
format, e.g 11204705797_10100412949637447
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 17 did some research, because I wanted to find 16 this out :). I found some ways how to start 15 different activities easily. But I can not 14 guarantee that this will work after upgrades 13 of facebook. I tested it with my current 12 facebook app and it works. At least I tested 11 it with "adb shell" using "am start .....".
Basic 10 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 9 can even type: "facebook://gugus.com/inbox" having 8 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 7 will start the inbox activity. Here some 6 Uris with examples. I think they speak for 5 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 4 parameters you can give to certain of those 3 uris, but I have no time to go through all 2 the code of those activities.
How did I do 1 this? check out apktool.
If any one want to directly open a photo 2
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 1 uploaded this picture and pid
is PhotoId
Enjoy :))
Launching of another application from your 8 application in android, can be done only 7 if Intent action you fire matches with intent 6 filter of other application you want to 5 launch.
As @patrick demonstrated, download 4 facebook.apk to emulator and try to run 3 that through adb shell command. It works 2 fine..
Pass Intent filter and data as an 1 Uri
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/groups/14531755***6215/")));
This directly opens facebook group having 1 the id: 14531755***6215 inside fb app
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.