android & facebook stream.publish problem... help!

HI all,

Im having a strange thing. Im having a code that was working that doesnt anymore. To me, I think i didnt make any changes...Can someone give me an idea what is wrong ?? I'm trying to publish a text with an image and a link using the attachment method of stream.publish.

here is the code :

            Bundle myParams = new Bundle();
            myParams.putString("message", "Je publie un TEST.");

            String attachment="{"name":"Gran Turismo 5","href":"http://www.unknown.com/?lang=fr","caption":"Sony Computer Entertainment","description":"Une vidéo proposée par Cedemo.","media":[{"type":"image","src":"http://www.unknown.com/prepicture//thumb_title/15/15061_1.jpg","href":"http://www.unknown.com/?lang=fr"}],"properties":{"Autre lien":{"text":"Cedemo","href":"http://www.unknown.com"}}}";

            myParams.putString("attachment",attachment);
            mFacebook.dialog(Example.this,"stream.publish",myParams, new PostSampleDialogListener());

What is happening is that I am getting only the "Message" text published on facebook and nothing about my attachment... There is no error code returned by the function. I dont understand, this code has been working before...

THE SOLUTION

You have to You have to use the function URLEncoder.encode to encode your parameters. Example : myParams.putString("attachment", URLEncoder.encode("{"name":""..... ))


附件变量需要URL编码!!

链接地址: http://www.djcxy.com/p/49600.html

上一篇: 使用Androids Facebook SDK直接发布到Facebook流/墙!

下一篇: android&facebook stream.publish问题...帮助!