嘿,我的朋友们,我在回拨appinvitedialog时遇到问题,它不起作用,我尝试了很多东西,但没有结果,请帮助我:
public void openDialogInvite(Activity activity)
{
String appLinkUrl, previewImageUrl;
appLinkUrl = "url";
previewImageUrl = "img";
if (AppInviteDialog.canShow())
{
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
CallbackManager sCallbackManager = CallbackManager.Factory.create();
AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
appInviteDialog.registerCallback(sCallbackManager, new FacebookCallback<AppInviteDialog.Result>()
{
@Override
public void onSuccess(AppInviteDialog.Result result) {
Toast.makeText(getApplicationContext(),"Success",Toast.LENGTH_LONG).show();
}
@Override
public void onCancel() {
Toast.makeText(getApplicationContext(),"Success",Toast.LENGTH_LONG).show();
}
@Override
public void onError(FacebookException error) {
Toast.makeText(getApplicationContext(),"Success",Toast.LENGTH_LONG).show();
}
});
appInviteDialog.show(content);
}
}
在此处输入代码
最佳答案
您是否在CallbackManager
方法中调用了onActivityResult
?
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult( requestCode, resultCode, data );
callbackManager.onActivityResult( requestCode, resultCode, data );
}
关于android - Android Facebook SDK AppInviteDialog回调无法正常工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39528598/