android - Facebook 3.0 How to post wall? -
so new facebook 3.0 offers guides how post on wall. do when doesn't fly?
i following response facebook:
{response: responsecode: 400, graphobject: null, error: {httpstatus: 400, errorcode: 100, errortype: oauthexception, errormessage: (#100) missing message or attachment}, isfromcache:false} here permission update:
session session = parsefacebookutils.getsession(); if(session != null) { list<string> permissions = session.getpermissions(); if (!issubsetof(permissions, permissions)) { session.newpermissionsrequest newpermissionsrequest = new session .newpermissionsrequest(this, permissions); session.requestnewpublishpermissions(newpermissionsrequest); return; } publishstory(); } permissions has following:
private static final list<string> permissions = arrays.aslist("publish_actions"); here publish code (not completely) copy paste facebook:
private void publishstory() { bundle postparams = new bundle(); postparams.putstring("name", "test"); postparams.putstring("caption", "another test"); postparams.putstring("description", medit.gettext().tostring()); request.callback callback = new request.callback() { public void oncompleted(response response) { jsonobject graphresponse = response .getgraphobject() .getinnerjsonobject(); //fixme <-- here error string postid = null; try { postid = graphresponse.getstring("id"); } catch (jsonexception e) { log.i(globalvalues.log_tag, "json error "+ e.getmessage()); } facebookrequesterror error = response.geterror(); if (error != null) { toast.maketext(getactivity() .getapplicationcontext(), error.geterrormessage(), toast.length_short).show(); } else { toast.maketext(getactivity() .getapplicationcontext(), postid, toast.length_long).show(); } } }; request request = new request(parsefacebookutils.getsession(), "me/feed", postparams, httpmethod.post, callback); requestasynctask task = new requestasynctask(request); task.execute(); } all appreciated.
edit:
here list of permissions @ request time:
[status_update, photo_upload, video_upload, create_note, share_item, publish_stream, publish_actions, basic_info]
did check publish permissions? code link posted checks permissions before sending request.
// check publish permissions list<string> permissions = session.getpermissions(); if (!issubsetof(permissions, permissions)) { pendingpublishreauthorization = true; session.newpermissionsrequest newpermissionsrequest = new session .newpermissionsrequest(this, permissions); session.requestnewpublishpermissions(newpermissionsrequest); return; } edit: try adding message parameter:
bundle postparams = new bundle(); postparams.putstring("name", "test"); postparams.putstring("caption", "another test"); postparams.putstring("description", medit.gettext().tostring()); postparams.putstring("message", "my message");
Comments
Post a Comment