我是facebook api的初学者,我必须说文档非常糟糕。 现在我可以从我的应用程序发布到我的墙上并添加一些内容,但我无法在互联网上找到如何用我想要的页面打开Facebook。
任何人都可以告诉我该怎么做?
答案 0 :(得分:8)
如果你想通过在Android的官方facebook应用程序中提供FB页面ID来打开特定页面,请执行以下操作:
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);
}
fb app can be found here支持的完整网址方案。