1
我正在开发一个应用程序,它在Facebook中共享一些信息。对于我这样做:从Facebook链接打开应用程序
if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
// Publish the post using the Share Dialog
FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
.setName(attraction.getName())
.setLink("http://developer.neosperience.com/")
.setDescription(attraction.getDescription())
.setRef(String.valueOf(id_attraction))
.setPicture(pictureURLtoShare)
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
}
我的问题是我需要发送一个参数(id_attraction),所以当从Facebook帖子被点击它会打开我的应用程序,我收到的参数。我认为setRef会工作,但我收到null。 这是我收到的意图:
AppLinkData appLinkData = AppLinkData.createFromActivity(this);
if (appLinkData != null) {
Bundle arguments = appLinkData.getArgumentBundle();
//appLinkData.
if (arguments != null) {
String targetUrl = arguments.getString("target_url");
if (targetUrl != null) {
Log.i("Activity FB", "Target URL: " + targetUrl);
}
}
}