Android:如何在我有ID的帖子上打开Facebook应用程序

时间:2015-01-31 20:40:39

标签: android facebook

我想打开Facebook应用程序 - 如果已安装 - 在我墙上的帖子上(我有帖子ID),怎么能做到这一点?我尝试了下面的代码,但它没有工作,它导致异常,它只是打开Facebook应用程序,如图所示。

enter image description here

public static Intent getOpenFacebookIntent(String aPostID) {

    try {
        return new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/" + aPostID));
    } catch (Exception e) {
        return new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + aPostID));
    }
}

修改1:

这是我使用video.watches时的图形响应,它返回的是一个不同的帖子ID(不适用于fb://方案),而不是我在墙上的帖子时间上悬停时使用的那个ID PC浏览器(使用fb://方案)....如何获得正确的帖子ID?

enter image description here

谢谢:)

1 个答案:

答案 0 :(得分:2)

而不是

fb://page/

您需要访问

fb://post/{postId}?owner={uid}

其中postId采用uid_postid格式。

希望有所帮助