I am using following code to open a facebook page from my android app. Its opening the page using my Fb app but the page opened is not exactly the fb page. Its more like about section. Screenshots attached.
public static String FACEBOOK_URL = "https://www.facebook.com/LocalPakistaniGamesAndroid/";
public static String FACEBOOK_PAGE_ID = "LocalPakistaniGamesAndroid";
public String getFacebookPageURL(Context context) {
PackageManager packageManager = context.getPackageManager();
try {
int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;
if (versionCode >= 3002850) { //newer versions of fb app
Log.d("MY","new version");
return "fb://facewebmodal/f?href=" + FACEBOOK_URL;
} else { //older versions of fb app
Log.d("MY","old version");
return "fb://page/" + FACEBOOK_PAGE_ID;
}
} catch (PackageManager.NameNotFoundException e) {
Log.d("MY", "App not found");
return FACEBOOK_URL; //normal web url
}
}
Intent facebookIntent = new Intent(Intent.ACTION_VIEW);
String facebookUrl = getFacebookPageURL(this);
facebookIntent.setData(Uri.parse(facebookUrl));
startActivity(facebookIntent);