Android 如何链接到特定Facebook新闻源帖子的页面(在应用程序或浏览器中)?

Android 如何链接到特定Facebook新闻源帖子的页面(在应用程序或浏览器中)?,android,facebook,facebook-graph-api,Android,Facebook,Facebook Graph Api,在我的Android应用程序中,我使用Facebook SDK登录并显示来自用户新闻源的帖子。我想让他们可以发表评论或发表文章,但我不想实现这一点。因此,我的解决方案是允许用户点击帖子,然后将帖子页面加载到官方Facebook应用程序中,或者只加载到移动Facebook网站中。无论哪种方式对我都很好 我在谷歌上四处搜索,找不到合适的方式将启动Facebook应用程序的意图传达到特定的帖子页面。因此,我决定尝试启动浏览器,并导航到移动Facebook网站上的特定帖子。我使用关于当前用户、帖子id和

在我的Android应用程序中,我使用Facebook SDK登录并显示来自用户新闻源的帖子。我想让他们可以发表评论或发表文章,但我不想实现这一点。因此,我的解决方案是允许用户点击帖子,然后将帖子页面加载到官方Facebook应用程序中,或者只加载到移动Facebook网站中。无论哪种方式对我都很好

我在谷歌上四处搜索,找不到合适的方式将启动Facebook应用程序的意图传达到特定的帖子页面。因此,我决定尝试启动浏览器,并导航到移动Facebook网站上的特定帖子。我使用关于当前用户、帖子id和它所属的朋友id的信息构建url字符串。此url与我从新闻源在浏览器中浏览页面时看到的url完全相同。像这样:

                String url = "http://m.facebook.com/#!/story.php?story_fbid=" + postId + "&id=" + friendId + "&_user=" + FBHelper.getCurrentUserId();
                Uri uri = Uri.parse(url);

                Intent intent = new Intent(Intent.ACTION_VIEW, uri);

                startActivity(intent);
然而,当浏览器加载时,我会看到一个页面,上面写着“对不起,出了问题。我们正在尽快修复此问题。”我已经尝试了touch.facebook.com和m.facebook.com


我正在寻找任何解决方案,既可以让我打开移动站点来发布所选帖子,也可以让我启动Facebook应用程序来发布所选帖子活动

我刚刚想到了这一点。事实证明,我从对graph api的newsfeed请求的json结果中获得的post id有额外的信息。我从newsfeed结果中获得的帖子id是“friendid\u postid”形式的。但是,在链接中,“story\u fbid”标签应该设置为posted部分。那就行了

这是我使用的代码:

            String postId = idTextView.getText().toString();
            postId = postId.substring(postId.indexOf("_") + 1, postId.length());
            String friendId = friendIdTextView.getText().toString();


            String url = "http://m.facebook.com/#!/story.php?story_fbid=" + postId + "&id=" + friendId + "&_user=" + FBHelper.getCurrentUserId();
            Uri uri = Uri.parse(url);

            Intent intent = new Intent(Intent.ACTION_VIEW, uri);

            startActivity(intent);

我刚想出来。事实证明,我从对graph api的newsfeed请求的json结果中获得的post id有额外的信息。我从newsfeed结果中获得的帖子id是“friendid\u postid”形式的。但是,在链接中,“story\u fbid”标签应该设置为posted部分。那就行了

这是我使用的代码:

            String postId = idTextView.getText().toString();
            postId = postId.substring(postId.indexOf("_") + 1, postId.length());
            String friendId = friendIdTextView.getText().toString();


            String url = "http://m.facebook.com/#!/story.php?story_fbid=" + postId + "&id=" + friendId + "&_user=" + FBHelper.getCurrentUserId();
            Uri uri = Uri.parse(url);

            Intent intent = new Intent(Intent.ACTION_VIEW, uri);

            startActivity(intent);

您是否尝试过:“+postId+”&id=“+friendId”?这是我桌面浏览器中的url。刚刚尝试过。不知怎的,它只是将我带到一个空白页面。移动浏览器中根本没有显示任何内容。您尝试过:“+postId+”&id=“+friendId”吗?这是我桌面浏览器中的url。刚刚尝试过。不知怎的,它只是把我带到了一个空白页。手机浏览器中根本不显示任何内容。