我切换到 Facebook 4.0 以便为 Android 实现 AppInviteDialog。我遵循了这个参考。
出现对话框,我可以选择朋友,邀请他们,我onSuccess()
接到电话,但我的朋友没有接到邀请。
我使用了以下 applink URL:https://fb.me/****412097*****
尽管我在对话框中看到了我的应用程序的图像,但没有 previewImageURL。
代码:
//Inside onCreate -
callbackManager = CallbackManager.Factory.create();
mInvititeDialog = new AppInviteDialog(this);
mInvititeDialog.registerCallback(callbackManager,
new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(Result result) {
NetworkController.showCustomToast(
InviteFriendsActivity.this,
"Invitation Sent Successfully!");
finish();
}
@Override
public void onCancel() {
Log.d("Result", "Cancelled");
NetworkController.showCustomToast(
InviteFriendsActivity.this, "Cancelled");
finish();
}
@Override
public void onError(FacebookException exception) {
Log.d("Result", "Error " + exception.getMessage());
NetworkController.showCustomToast(
InviteFriendsActivity.this,
"Error while inviting friends");
finish();
}
});
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl).build();
AppInviteDialog.show(InviteFriendsActivity.this, content);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
以下类似链接没有帮助(即使它们来自 ios)
https://stackoverflow.com/questions/27547826/facebook-app-invites-issue