如何在android中过滤facebook分享意图?

时间:2016-06-04 07:10:24

标签: android

我有一个分享按钮。我与一些文本和URL共享一条消息。它与whatsapp,Twitter和Gmail配合得很好。但是,在Facebook分享中,我只能分享网站链接。之后,在网上搜索我找到了Facebook分享的ShareDialog类。我的问题是当用户点击android默认共享对话框上的facebook图标时如何检测(例如:onClick()为facebook图标)。这是正确的方法吗?还是有其他替代品?

我的代码:

public void shareApp() {       
    Intent sendIntent = new Intent();
    String websiteLink = "https://www.manam.com";
    String playStoreLink = "http://www.google.com";
    String msg = "\nHey, found this cool & easy on-demand app.";
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_SUBJECT, msg);
    sendIntent.putExtra(Intent.EXTRA_TEXT,playStoreLink + msg);
    sendIntent.setType("text/plain");
    startActivity(Intent.createChooser(sendIntent, ""));
}

1 个答案:

答案 0 :(得分:1)

这是Facebook的政策。 实施共享时,您的应用不应预先填写要共享的内容。这与Facebook平台政策不一致,请参阅{{3}}。 我也没有看到检测点击facebook图标的选项。即使您可以显示您的共享对话框,您也无法预先填充任何数据