Thursday, March 23, 2017
Open a Facebook fan page from Android application
Open a Facebook fan page from Android application
Id like to share how to invoke FB fanpage from your Android application programmatically. Before that please get your FB fanpage ID. TO find your FB fanpage ID , LOGIN to your fanpage. Find the Edit Page button and choose any option from the Admin menu. The fanpage ID is located in the URL after the keyword ID. Select and Copy the number.
***Or you could find the page ID at the Edit Page > Update Page Info, in the Page Info window, look at the bottom (last detail).
This is the code to invoke the FB fanpage on the mobile users smartphone from your app. Provide the FB app is installed.
Intent ifb=new Intent (Intent.ACTION_VIEW);
String uri="fb://page/613598055326974"; //your FB fanpage ID is here
Uri.parse(uri);
ifb.setData(Uri.parse(uri));
startActivity(ifb);
Updated:
If you consider maybe the phone doesnt has Facebook app installed, may be youd like to redirect to a browser instead. Then below is the code;
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/129569063811850"));
startActivity(intent);
} catch(Exception e) {// or else open in browser instead
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://facebook.com/mmathurat")));
}
Go to link Download