gpt4 book ai didi

android - Facebook 共享对话框未显示 - Android Facebook API

转载 作者:行者123 更新时间:2023-11-29 02:28:22 25 4
gpt4 key购买 nike

单击 facebook 共享按钮时,共享对话框出现并立即消失。在 shareDialog.registerCallback 中,它转到 onError 方法。不明白为什么会这样。

CallbackManager callbackManager;
ShareDialog shareDialog;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FacebookSdk.setApplicationId(String.valueOf(R.string.facebook_app_id));
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
shareDialog = new ShareDialog(this);

shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
Toast.makeText(MainActivity.this, "onSuccess", Toast.LENGTH_SHORT).show();
}

@Override
public void onCancel() {
Toast.makeText(MainActivity.this, "onCancel", Toast.LENGTH_SHORT).show();
}

@Override
public void onError(FacebookException error) {
Toast.makeText(MainActivity.this, "Opps! Some error occurred. Please try again", Toast.LENGTH_SHORT).show();
}
});

bFbShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setQuote("Hi ABCE") .setContentUrl(Uri.parse("https://play.google.com/store/apps/details?id=" + getApplicationContext().getPackageName()))
.build();
shareDialog.show(MainActivity.this, linkContent);
}
}
});

Logcat 我明白了

GraphResponse: {HttpStatus: 404, errorCode: 803, subErrorCode: -1, errorType: OAuthException, errorMessage: (#803) 您请求的一些别名不存在:2131492917}

最佳答案

onClick 中删除 if (ShareDialog.canShow(ShareLinkContent.class)) 对我有用。

关于android - Facebook 共享对话框未显示 - Android Facebook API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50949642/

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