How can I start an intent to open a Facebook application on a phone and navigate to the prefered page in Facebook?
I tried:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.facebook.katana", "com.facebook.katana.ProfileTabHostActivity");
intent.putExtra("extra_user_id", "123456789l");
this.startActivity(intent);
Well, whatever I write to "1234567891", it is always navigating to my page. Always to me and not else.
How could I do this?
I had the exactly same problem, sent the user id but for some reason, my profile always opened instead of the friend's profile.
The problem is that if you pass the
String
of theLong
object that represents the Facebook UID, or even along
primitive type, the intent won't be able to read it later. You need to pass a realLong
.So the complete code is:
Ok enjoy and hope this helps :-)
Maxim
Here is the best and simple way to do it. Just follow the code
This solution won't work any more. The new version of the facebook app doesn't support anymore those kind of intents. See here the bug report
The new solution is to use the iPhone scheme mechanism (Yes, facebook decided to support the iPhone mechanism in Android instead of the implicit intent mechanism of Android).
So in order to open the facebook app with a user profile all you need to do is:
If you are looking for other actions you can use the following page for all available actions (/you have to test it though, since I didn't find an official publication of facebook about this)
try this code :