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);
}
}
}