Open Facebook page from Android app?


from my Android app, I would like to open a link to a Facebook profile in the official Facebook app (if the app is installed, of course). For iPhone, there exists the fb:// URL scheme, but trying the same thing on my Android device throws an ActivityNotFoundException.

Is there a chance to open a Facebook profile in the official Facebook app from code?

1/26/2011 10:28:55 PM

Accepted Answer

In Facebook version (3002850) fb://profile/ and fb://page/ no longer work. I decompiled the Facebook app and found that you can use fb://facewebmodal/f?href=[YOUR_FACEBOOK_PAGE]. Here is the method I have been using in production:

 * <p>Intent to open the official Facebook app. If the Facebook app is not installed then the
 * default web browser will be used.</p>
 * <p>Example usage:</p>
 * {@code newFacebookIntent(ctx.getPackageManager(), "");}
 * @param pm
 *     The {@link PackageManager}. You can find this class through {@link
 *     Context#getPackageManager()}.
 * @param url
 *     The full URL to the Facebook page or profile.
 * @return An intent that will open the Facebook page/profile.
public static Intent newFacebookIntent(PackageManager pm, String url) {
  Uri uri = Uri.parse(url);
  try {
    ApplicationInfo applicationInfo = pm.getApplicationInfo("com.facebook.katana", 0);
    if (applicationInfo.enabled) {
      uri = Uri.parse("fb://facewebmodal/f?href=" + url);
  } catch (PackageManager.NameNotFoundException ignored) {
  return new Intent(Intent.ACTION_VIEW, uri);
10/30/2015 5:47:07 PM

This works on the latest version:

  1. Go to<user_name_here> ( for instance)
  2. Copy your id
  3. Use this method:

    public static Intent getOpenFacebookIntent(Context context) {
       try {
        context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
        return new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/<id_here>"));
       } catch (Exception e) {
        return new Intent(Intent.ACTION_VIEW, Uri.parse("<user_name_here>"));

This will open the Facebook app if the user has it installed. Otherwise, it will open Facebook in the browser.

EDIT: since version (3002850) Facebook App do not support this way anymore, there's another way, check the response below from Jared Rummler.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow