How to launch a Facebook Page in native Facebook app or browser from your android app


In this tutorial we are going to write a function to launch our apps Facebook page from a click event.

Before implementing this we need to obtain Facebook page ID which we need to launch.

How to get Facebook page ID

Its very simple,  First navigate to your Facebook page then look for the number after page name in URL

Example – It looks some thing like this  “(” copy this Facebook Page ID.

Now we can move to Android studio and copy paste the following code

public void facebook()
    boolean installed = appInstalledOrNot("com.facebook.katana");                  //
    if(installed)                                                                  // We check whether Facebook app is installed or not
        String facebookID = "1136754489778781";
        final String url = "fb://page/" + facebookID;
        Intent facebookAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    else                                                                           // If its not found we launch it in browser
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("")));