发布的附件而不需使用Facebook的Andr​​oid SDK中打开的对话​​框? [英] Posting attachment without open dialog using Facebook Android SDK?

查看:83
本文介绍了发布的附件而不需使用Facebook的Andr​​oid SDK中打开的对话​​框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作在Facebook整合在我的Andr​​oid应用程序。我可以通过使用stream.publish与打开的对话​​框中发送附件。有没有一种方法来发布,而无需打开对话框? 我使用下面的方法。

请给我任何的想法。

  postParams.put(seriesname+'+系列+',在电视节目中评论);
            postParams.put(说明,文本);
            parameters.putString(附件,{\名称\:\+ postParams.get(seriesname)+\,
                    +\HREF \:\+的http://www.google.com \,+\描述\:\+ postParams.get(说明)+\ });

            mFacebook.dialog(FacebookComments.thisstream.publish,参数,新SampleDialogListener());
            Log.d(脸谱反应,反应);
            如果(响应==空|| response.equals()
                    || response.equals(假)){
                Log.v(错误,空白响应);
            }
        }
    }赶上(例外五){
        Log.e(脸谱,错误:+ e.getMessage());
    }
}
 

解决方案

勾选此$ C $下发布在Facebook的墙没有对话:

 公共布尔postOnWall(弦乐味精){
    Log.d(测试,测试图形API的墙后);
     尝试 {
         字符串响应;
         捆绑参数=新包();
         parameters.putString(信息,味精);
         parameters.putString(说明,测试测试测试);
         parameters.putString(标签,为person_id);
         响应= ZValues​​.authenticatedFacebook.request(ME /饲料,参数,POST);
         Log.d(测试,得到了回应:+响应);
         如果(响应==空|| response.equals()|| response.equals(假)){
            Log.v(错误,空白响应);
            返回false;
         }
     }赶上(例外五){
         e.printStackTrace();
     }
    返回true;
}
 

勾选此<一个href="http://stackoverflow.com/questions/5170355/android-send-a-facebook-post-with-custom-actions">for在帖子发出的链接

I am working on Facebook Integration in my Android app. I am able to send attachment by using "stream.publish" with opening dialog. Is there a way to post without opening dialog? I am using following method.

Please give me any idea.

            postParams.put("seriesname", "Commented during the TV show"+" '"+series+"'");
            postParams.put("description", text);
            parameters.putString("attachment", "{\"name\":\""+postParams.get("seriesname")+"\","
                    +"\"href\":\""+"http://www.google.com\","+"\"description\":\""+postParams.get("description")+"\"}");

            mFacebook.dialog(FacebookComments.this, "stream.publish", parameters, new SampleDialogListener());
            Log.d("FACEBOOK RESPONSE", response);
            if (response == null || response.equals("")
                    || response.equals("false")) {
                Log.v("Error", "Blank response");
            }
        }
    } catch (Exception e) {
        Log.e("Facebook", "Error: " + e.getMessage());
    }
}

解决方案

Check this code for Posting in Facebook wall without Dialog :

public boolean postOnWall(String msg) {
    Log.d("Tests", "Testing graph API wall post");
     try {
         String response;
         Bundle parameters = new Bundle();
         parameters.putString("message", msg);
         parameters.putString("description", "test test test");
         parameters.putString("tags",person_id);
         response = ZValues.authenticatedFacebook.request("me/feed", parameters,"POST");
         Log.d("Tests", "got response: " + response);
         if (response == null || response.equals("") || response.equals("false")) {
            Log.v("Error", "Blank response");
            return false;
         }
     } catch(Exception e) {
         e.printStackTrace();
     }
    return true;
}

Check this for sending links in Post

这篇关于发布的附件而不需使用Facebook的Andr​​oid SDK中打开的对话​​框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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