Open Facebook page from Android app?

open facebook app from browser
open facebook app from link
open instagram page from android app
fb://facewebmodal/f?href=
facebook app link android
open twitter page from android app
open facebook link in app instead of browser
open facebook app from link javascript

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?

In Facebook version 11.0.0.11.23 (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(), "https://www.facebook.com/JRummyApps");}
 *
 * @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) {
      // http://stackoverflow.com/a/24547437/1048340
      uri = Uri.parse("fb://facewebmodal/f?href=" + url);
    }
  } catch (PackageManager.NameNotFoundException ignored) {
  }
  return new Intent(Intent.ACTION_VIEW, uri);
}

Open Facebook Page in Facebook App (if installed) on Android , This example demonstrates about How to open Facebook page from Android app?Step 1 − Create a new project in Android Studio, go to File  Manage your Facebook Page, right from your phone. With the Pages Manager app you can stay informed and respond to customers immediately. Mobile posting: post updates and manage your Page without using a computer. Messages: read and reply to messages that your customers send to your Page.

This works on the latest version:

  1. Go to https://graph.facebook.com/<user_name_here> (https://graph.facebook.com/fsintents 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("https://www.facebook.com/<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 11.0.0.11.23 (3002850) Facebook App do not support this way anymore, there's another way, check the response below from Jared Rummler.

How to open Facebook page from Android app?, A try-catch-block is the key to deep linking your Android app to Facebook regardless of whether the user has the native Facebook app on her  The most important desktop features of Facebook are also available on the app, such as writing on timelines, liking photos, browsing for people, and editing your profile and groups. Now you can get early access to the next version of Facebook for Android by becoming a beta tester.

Is this not easier? For example within an onClickListener?

try {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/426253597411506"));
    startActivity(intent);
} catch(Exception e) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/appetizerandroid")));
}

PS. Get your id (the large number) from http://graph.facebook.com/[userName]

How to use this hack to open a specific Facebook page from your , Video shows you how to add link to your Facebook page in your Android app. If you learn Duration: 5:27 Posted: Nov 16, 2018 6 – Toggle the “Links open externally” setting to On (it should turn from gray to blue). That’s all there is to it. From now on the Facebook app will load all external links in your device’s default web browser instead of the slimmed-down in-app browser. And speaking of mobile web browsers…

For Facebook page:

try {
    intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/" + pageId));
} catch (Exception e) {
    intent =  new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + pageId));
}

For Facebook profile:

try {
    intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/" + profileId));
} catch (Exception e) {
    intent =  new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + profileId));
}

...because none of the answers points out the difference

Both tested with Facebook v.27.0.0.24.15 and Android 5.0.1 on Nexus 4

Open Facebook Page in Android Studio, 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  Pages Manager for Facebook is the only fully featured Facebook Pages Manager app on Windows that you can use to manage all your Facebook pages. The app allows you to post, delete or share your pages status, upload photos, send and receive messages from your pages, comment on your posts or reply to a comment and a lot more.

Here's the way to do it in 2016, works great, and is very easy.

I discovered this after looking into how emails send by facebook opened the app.

// e.g. if your URL is https://www.facebook.com/EXAMPLE_PAGE, you should put EXAMPLE_PAGE at the end of this URL, after the ?
String YourPageURL = "https://www.facebook.com/n/?YOUR_PAGE_NAME";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(YourPageURL));

startActivity(browserIntent);

Open facebook with intent in android, The App Links SDK for Android is a component of the Facebook SDK for Android. In your project, open your_app | Gradle Scripts | build.gradle (Module: app) If you marked up your metadata on a web page and didn't specify an Android  Create an account or log into Facebook. Connect with friends, family and other people you know. Share photos and videos, send messages and get updates.

Android - App Links, On This Page This guide details how to enable sharing from your Android app to Facebook. In your project, open your_app | Gradle Scripts | build.gradle (​Project) and add the following repository to the buildscript { repositories {}} section  Log into Facebook to start sharing and connecting with your friends, family, and people you know.

Android - Sharing, package facebook.page.test;. import android.content.Intent;. import android.​content.pm.PackageManager;. import android.net.Uri;. import android.support.v7.​app  Welcome to Club Factory’s official Facebook page. Your one-stop shopping destination: everything, fair price. Fr

Android Sample Open Facebook Page · GitHub, 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://  Android Sample Open Facebook Page. GitHub Gist: instantly share code, notes, and snippets.

Comments
  • There's a thread that doesn't have an answer on the facebook dev forums: forum.developers.facebook.net/viewtopic.php?pid=255227 (adding it here because it shows there's not an obvious answer, and maybe it'll get answered there someday...)
  • you can see my answer from here.
  • @DjHacktorReborn you should no longer use the ids. Just use the normal link.
  • @DjHacktorReborn Just checked, working here. On Facebook version 13.0.0.13.14
  • @AbdulWasae It has worked in apps with millions of downloads. If you have a better solution please post it instead of downvoting a working solution.
  • can anyone confirm, that this still works? (as of June 2019). I still get ActivityNotFoundException
  • This opens the facebook page but unlike regular fb pages , we don't see the Like button, profile and cover photos, etc. it directly opens the Contact info and displays all the posts from the page.
  • Thanks for this, helped me out greatly! Now if only there was a way to do it for twitter
  • For a list of url schemes available on iOS see wiki.akosma.com/IPhone_URL_Schemes - some of them should work also on Android
  • & here's the answer of that issue; use "page" instead of profile - stackoverflow.com/a/15872383/1433187
  • Just to note that fb://profile/ is NOT supported on Facebook app v1.3.2 which is included in stock Nexus One 2.3.6
  • DjHacktorReborn is right, neither fb://profile/<fpid> nor fb://page/<fpid> are working anymore starting fb v11
  • I agree, this is better because it does not make any assumptions about the Facebook app package name or intent filters. However, it is worse for the same reason because other apps might also specify matching intent filters. It depends what you want. Maybe add you do intent.setPackageName("com.facebook.katana") to make sure no other apps are called.