I am using Simple Facebook. Unfortunately I can't send invites with SimpleFacebook so I am using AppInviteDialog to invite friends.
public void openDialogInvite(final Activity activity) {
String AppURl = "my FB url..."; //Generated from //fb developers
String previewImageUrl = "urlImage...";
sCallbackManager = CallbackManager.Factory.create();
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(AppURl).setPreviewImageUrl(previewImageUrl)
.build();
AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
appInviteDialog.registerCallback(sCallbackManager,
new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(AppInviteDialog.Result result) {
Log.d("Invitation", "Invitation Sent Successfully");
System.out.println("test onSuccess");
}
@Override
public void onCancel() {
System.out.println("test on cancel");
}
@Override
public void onError(FacebookException e) {
Log.d("Invitation", "Error Occured");
System.out.println("test Error"+e.getMessage());
}
});
appInviteDialog.show(content);
}
}
The dialog open Facebook invite screens:
The invite progress bar look like everything is ok
But, i get no response in the dialog callback.
i thought the problem was my AppLink because in the folowing code, appLink is always null:
SimpleFacebook.initialize(this);
Uri targetUrl = AppLinks.getTargetUrlFromInboundIntent(ProfileActivity.this, getIntent());
if (targetUrl != null) {
Log.i("Activity", "App Link Target URL: " + targetUrl.toString());
} else {
AppLinkData.fetchDeferredAppLinkData(
this,
new AppLinkData.CompletionHandler() {
@Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
//process applink data
Log.i("Activity", "App Link Target URL: " + appLinkData);
}
});
}
AppLink was always null, so i used "Quick Start for App Links Hosting API", and created the appLink manually and i send it in the dialog.
Why i don't get nothing on callback response? and Facebook users do not receive my invite?
I have the same problem. It used to work for me about two weeks ago when I tested it in a development branch. Now after deploying it last week, the invited user always has appLinkData null.
I made some further changes but even when I now checkout the revision that used to work, the appLinkData is null.
Sorry for writing this as an answer instead of a comment but I don't have enought reputation yet.