我正在使用以下代码从我的Android应用程序打开Facebook页面。它使用我的Fb应用打开页面,但打开的页面并不完全是fb页面。它更像是关于部分。附上截图。
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);
实际页面:http://oi66.tinypic.com/2yycp6c.jpg http://oi66.tinypic.com/2yycp6c.jpg