2

Possible Duplicate:
launch facebook app from other app

Im a beginner with facebook api and i must say the documentation is very bad. Now i can post to my wall from my app and add some content, but i just cant find anywhere on internet how to open facebook with the page i want.

Anyone can tell me how to do this?

Community
  • 1
  • 1
Adam Varhegyi
  • 11,307
  • 33
  • 124
  • 222

1 Answers1

8

If you want to open a specific page by giving FB page id within official facebook app for android, do something like this:

try {
      //try to open page in facebook native app.
      String uri = "fb://page/" + yourFBpageId;    //Cutsom URL
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
      startActivity(intent);   
}catch (ActivityNotFoundException ex){
      //facebook native app isn't available, use browser.
      String uri = "http://touch.facebook.com/pages/x/" + yourFBpageId;  //Normal URL  
      Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));    
      startActivity(i); 
}

complete URL scheme supported by fb app can be found here.

Community
  • 1
  • 1
Adil Soomro
  • 37,609
  • 9
  • 103
  • 153