Android Facebook SDK和URL方法成功的“对话”对话框,但无法提交 [英] Android Facebook SDK and URL Methods form successful Friends Dialog, but cannot commit

查看:211
本文介绍了Android Facebook SDK和URL方法成功的“对话”对话框,但无法提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我开始认为是一个错误,请证明我错了:

This is one that I'm beginning to think is a bug, please, Please prove me wrong:

我想以编程方式向Facebook上的用户友好;他们只有和最肯定有人知道IRL。

I want to programmatically friend a user on Facebook; they are only and most certainly someone the person knows IRL.

以下三个解决方案都具有相同的结果:一个成功的朋友对话 - 意思是个人资料名称,图片,表示行动的陈述(给朋友的人),拒绝/确认按钮;按'确认'是问题:它导致在标准fb界面中显示的Facebook错误说对不起,出了问题我们正在尽快得到这个修正。我的用户登录,fb应用程序ID(fb_app_id)是黄色的,或片段的父活动不会被调用,我的待命用户ID(Id)也是黄金的,由他们的个人资料图片确认,我的应用程序和朋友对话框中的friends /操作是正确的 - 朋友/?给我一个很好的未找到错误 - 而且OnCompleteListener甚至可以在消息周围工作。

The following three solutions all have the same result: a successful friends dialog--meaning the profile name, picture, statement indicating the action( to friend someone ), and refusal/confirm buttons; pressing 'confirm' is the problem: it leads to a Facebook error presented in the standard fb UI saying "Sorry, something went wrong We're working on getting this fixed as soon as we can". My user is logged in and the fb app id( fb_app_id ) is golden, or the fragment's parent activity would not be called, my to-be-friended user id ( Id ) is also golden, confirmed by their profile picture showing up both in my app and in the friends dialog, the action "friends/" is correct--'friends/?' gives me a good ol' "not found" error--and the OnCompleteListener works fine even around the message.

第一种方法是使用SDK,我的首选如果工作:

First way is with the SDK, my preferred if it worked:

Bundle params = new Bundle( );
params.putString( "id", Id );
WebDialog requestsDialog = (
new WebDialog.Builder( this.getActivity( ),
        getString( R.string.fb_app_id ),
        "friends/", params )
    .setOnCompleteListener( new CompleteListener( ) )
    .build( ) );
requestsDialog.show( );

保存显式操作调用,看起来不错,不是吗?它肯定让我进入确认对话框;第二种方式是快速和肮脏,但它应该工作:

Save the explicit action call, that looks good, doesn't it? It certainly gets me to the confirmation dialog; second way is quick and dirty, but it should work:

String requestUrl = "https://www.facebook.com/dialog/friends/?id="+
    Id+"&app_id="+getString( R.string.fb_app_id )+
    "&redirect_uri=http://www.facebook.com";
WebDialog requestDialog = new WebDialog( this.getActivity( ), requestUrl );
requestDialog.show( );

但它没有;相同的准成功结果。第三种方式是我只是检查,以确保我不是一个白痴,基本上是这个帖子的建议
Facebook的朋友对话框返回未知方法错误
,但使用WebDialogs(我的OnCompleteListener实现),而不是不推荐使用的库。
同样的事情,同样的消息。

But it doesn't; same quasi-successful result. The third way was me just checking to make sure I wasn't an idiot, and is essentially the suggestion in this post Facebook friends dialog returns "Unknown method" error but with WebDialogs ( my OnCompleteListener implementation ) instead of the deprecated library. Same thing, same message.

这不是真的是/我/我的错误消息,你知道吗这是不推荐使用的API调用吗?错误消息字面上正确,fb的好人知道吗?有没有一些参数我实际上在这里失踪?这不是他们没有登录!我在这个机智上结束了这件事,谢谢你的帮助/建议/平静的话。 -AnB

It's not really an error message that's /for/ me, you know? Is this a deprecated API call? Is the error message literally correct and the good folks at fb are aware of this? Is there some param i'm actually missing here? It's not like they aren't signed in! I'm kind of at my wit's end on this one, thanks in advance for the help/advice/calming words. -AnB

当你写出来的时候,很有意思。 AB

P.S. 'friended' looks really funny when you write it out. AB

推荐答案

所以,它是Facebook上的错误,他们知道的一个,一个他们不会很快修复(开发人员的缺乏?策略?我会问马克...)。
听到这个令人不快的消息,然后我以几种不同的方式尝试了chrome的url,这是一个惊喜:当你在确认屏幕上请求桌面网站时,它的工作正常。

So, it is a bug on facebook, one that they are aware of, and one that they are not going to fix any time soon ( shortage in developer talent? "strategy"? I'll ask Mark... ). Hearing this dissappointing news, I then tried the url in chrome a few different ways, and big surprise: it works fine when you request the desktop site on the confirm screen.

所以,我们有一种方式留给我们的移动开发人员,那就是使用

So, there is one way left to us mobile devs, and that is to make a dialog that jails a webview with


  1. 一个桌面似的用户代理

  2. 一个URL覆盖,以阻止fb网站通过Intent.ACTION_VIEW重定向

这是我的实现(在片段中):

here's my implementation (in a fragment):

private void sendRequestDialog( ) {
    String requestUri = "https://www.facebook.com/dialog/friends/?id="+
         Id+"&app_id="+getString(R.string.fb_app_id)+
         "&redirect_uri=http://www.facebook.com";
    WebView webView = new WebView(this.getActivity());
    webView.getSettings().setUserAgentString(getString("Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0"));
    webView.setWebViewClient(new WebViewClient(){
        public boolean shouldOverrideUrlLoading(WebView view, String url){
            return false;
        }
    });
    webView.loadUrl(requestUri);
    AlertDialog.Builder dialog = new AlertDialog.Builder(this.getActivity());
    dialog.setView(webView);
    dialog.setPositiveButton("Done", new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {

                dialog.dismiss();
            }
        });
    dialog.show();

当然,您需要使这些字符串引用,但是这样做在UI。

Of course, you'll want to make those strings references, but this works and looks good in the UI.

向前!
-AnB

Onwards! -AnB

这篇关于Android Facebook SDK和URL方法成功的“对话”对话框,但无法提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆