如何知道在android中使用facebook应用程序共享或取消facebook墙帖
让我澄清我的问题。我使用facebook本机应用程序使用此代码在墙上发布如何知道在android中使用facebook应用程序共享或取消facebook墙帖,android,facebook,android-activity,Android,Facebook,Android Activity,让我澄清我的问题。我使用facebook本机应用程序使用此代码在墙上发布 public void sendToFB() { Intent share = new Intent(Intent.ACTION_SEND); share.setType("text/plain"); String _mPostText= "{\"name\":\"My Test Image\"," + "\"href\":\"" + "http://www.g
public void sendToFB()
{
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
String _mPostText=
"{\"name\":\"My Test Image\"," + "\"href\":\"" +
"http://www.google.com" + "\"," +
"\"media\":[{\"type\":\"image\",\"src\":\"" +
"http://www.google.com/logos/mucha10-hp.jpg" +
"\",\"href\":\"" + "http://www.google.com" + "\"}]" + "}";
share.putExtra(Intent.EXTRA_TEXT,_mPostText );
startActivityForResult(Intent.createChooser(share, "Share"), 100);
}
这是完美的工作。下面是结果的快照。
M为此目的设置OnActivityResult
代码如下
@Override
protected void onActivityResult(int requestcode, int resultcode, Intent arg2) {
// TODO Auto-generated method stub
if (resultcode == RESULT_OK) {
if (requestcode ==100){//do something
}
}
}
我的问题是,当facebook帖子被共享时,我想执行操作。
如果facebook帖子被取消,那么onActivityResult也会执行相同的操作。
我怎么知道facebook帖子是共享还是取消?
请建议我在这个问题上
提前感谢使用Android SDK而不是应用程序
SDK是开源的,如果它有相同的bug,您可以修复它。一个编写良好的活动如果被取消,应该返回
resultCode==RESULT\u CANCEL
。你是说事实并非如此吗?@rds在这两种情况下都返回resultcode=RESULT\u OK..这可能没有多大帮助,但我认为与Facebook共享的JavaScript方法也有同样的作用。Facebook不希望应用程序知道用户是否共享。您通常可以通过在出现提示时取消共享操作来下载共享锁定内容。使用graph api,我也可以处理此问题。但由于某些原因,我不得不只使用本机facebook应用程序。