Android Post mp3 file on Facebook
Hai Guys, I wish to POST *(not publish on wall)* an audio link to my friend in my list, i am using the below code i got an error.
Bundle params = new Bundle();
params.putString("method", "stream.publish");
params.putString("access_token", myaccesstoken);
params.putString("target_id", temp);
params.putString("attachment", "This string will appear as the status message");
params.putString("attachment", "URL of MP3 file");
params.putString("attachment", "Application Name");
mAsyncRunner.request("me/feed", params, "POST", new SampleUploadListener(),null);
The Error is
05-28 15:54:07.76开发者_运维百科7: DEBUG/Facebook-Example(5204): Response: {"error":{"type":"Exception","message":"Unsupported method, stream.publish"}}
According to the Facebook Legacy REST API Documentation, stream.publish
is being deprecated. Don't use it.
Do you want to send a message? "Post, not publish on wall" is pretty vague. A "post" on Facebook is (by definition) something in a profile feed aka a wall, so all "posts" are necessarily "on a wall". So I'm guessing you mean message (like in your friend's inbox).
You should read the newer Graph API Documentation, specifically the methods available under "Publishing". It currently is not supported to send messages, only to read them. FB will probably add message sending support but hasn't yet.
The preferred way in Facebook for an app to send a link to a user is by publishing a new post or link ("link" is just an alias for a post with the link
property set) to that user's profile. This is only possible if the target friend has granted the application the publish_stream
extended permission. You can use the /PROFILE_ID/links
method via HTTP POST as described in the Graph API Documentation. More information on the exact data that can be posted is described on the Graph API Post Documentation.
精彩评论