gpt4 book ai didi

Android Facebook SDK AppInviteDialog 回调不工作

转载 作者:搜寻专家 更新时间:2023-11-01 09:41:52 26 4
gpt4 key购买 nike

嘿,我的 friend 们,我在 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 Facebook SDK AppInviteDialog 回调不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39528598/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com