在命名的音频文件中的Facebook张贴在Android的问题音频文件、问题、Facebook、Android

2023-09-05 07:42:03 作者:遥遥无期

朋友们,我张贴的音频链接至Facebook好友留言板没有对话。 我能够在Facebook玩发布音频链接,但我无法得到爵位,姓氏吧。请参考图片 - 我要发布类似 ...

以下是我的code:

 尝试{
字符串userid =1000021233268431111;
捆绑PARAMS =新包();
params.putString(姓名,链接的名);
params.putString(标题,链接的标题);
params.putString(descrption,链接的descrption);
params.putString(标题,获取utellit发送消息像这样!);
params.putString(链接, "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
params.putString(类型,MP3);
params.putString(源, "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
字符串响应= facebook.request(((用户ID == NULL)我:用户ID)+/饲料,PARAMS,POST);
Log.v(回应,回应);
 }赶上(例外五){
}
 

如果我尝试使用JSON数组中添加附件,没有任何添加的参数和我得到空后是这样的:

使用JSON数组亩code是:

 捆绑参数=新包();
JSONObject的附件=新的JSONObject();
尝试 {
    JSONObject的媒体=新的JSONObject();
    media.put(类型,MP3);
    media.put(src用户, "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
    media.put(标题,听你的信息);
    media.put(艺术家,通过:utellit为Android);
    media.put(专辑,Utellit);
    attachment.put(媒体,新JSONArray()把(媒体)。);
}赶上(JSONException E1){
    // TODO自动生成的catch块
    e1.printStackTrace();
}
尝试 {
    attachment.put(信息,信息);
    attachment.put(名,获取utellit发送消息像这样!);
    attachment.put(HREF "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
}赶上(JSONException E){
    // TODO自动生成的catch块
    e.printStackTrace();
}
parameters.putString(附件,attachment.toString());
字符串响应= facebook.request(((用户ID == NULL)我:用户ID)+/饲料,参数,POST);
Log.v(回应,回应);
 

解决方案

最后我得到它。这里是我的解决办法:

 尝试{
字符串link =链接,应该去,如果按年点击获取utellit发送消息像这样;
字符串amazon_link =MP3链接,里面应该Facebook的发挥。
捆绑参数=新包();
JSONObject的附件=新的JSONObject();
尝试 {
    JSONObject的媒体=新的JSONObject();
    media.put(类型,MP3);
    media.put(src用户,amazon_link);
    media.put(标题,听你的信息);
    media.put(艺术家,通过:utellit为Android);
    media.put(专辑,Utellit);
    attachment.put(媒体,新JSONArray()把(媒体)。);
}赶上(JSONException E1){}

尝试 {
    attachment.put(信息,信息);
    attachment.put(名,获取utellit发送消息像这样!);
    attachment.put(HREF链接);
}赶上(JSONException E){}
parameters.putString(附件,attachment.toString());
parameters.putString(信息,文字是瘸子听好了:);
parameters.putString(target_id,XXXX); //目标ID发布
parameters.putString(法,stream.publish);
串响应= facebook.request(参数);
}
 
录音工程中 6 个需要避免发生的错误

赶上(例外五){}

facebook.request 方法,我们应该只发送参数和后的方法应该在附件添加

最后我张贴在Facebook中看起来喜欢这样的:

Friends, I posted the Audio link to Facebook Friends wall without Dialog. I'm able to play the Posted Audio link within Facebook, but i am unable to give title , name for it. Refer the Picture - I want to Post like ..

Following is my code :

try{
String userID="1000021233268431111";
Bundle params = new Bundle();
params.putString("name", "name of link");
params.putString("title", "title of link");
params.putString("descrption", "descrption of link");
params.putString("caption", "Get utellit to send messages like this!");
params.putString("link", "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
params.putString("type", "mp3");
params.putString("source", "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
String  response = facebook.request(((userID == null) ? "me" : userID) + "/feed", params, "POST");       
Log.v("response", response);
 }  catch(Exception e){
}

If i try to use the JSON Array to add attachment,nothing is added in the Parameter and i am getting Empty post like this:

Using JSON ARRAY mu code is :

    Bundle parameters = new Bundle();
JSONObject attachment = new JSONObject();
try {
    JSONObject media = new JSONObject();
    media.put("type", "mp3");
    media.put("src", "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
    media.put("title", "Listen to your message");
    media.put("artist", "By: utellit for Android");
    media.put("album", "Utellit");
    attachment.put("media", new JSONArray().put(media));
} catch (JSONException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}
try {
    attachment.put("message", "Messages");
    attachment.put("name", "Get utellit to send messages like this!");
    attachment.put("href", "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
} catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
parameters.putString("attachment", attachment.toString());
String  response =facebook.request(((userID == null) ? "me" : userID) + "/feed",parameters, "POST");
Log.v("response", response);

解决方案

Finally i got it.. Here is my solution :

try{
String link="LINK that should goes if yoy click Get utellit to send messages like this";
String amazon_link=".mp3 link that should play inside Facebook";
Bundle parameters = new Bundle();
JSONObject attachment = new JSONObject();
try {
    JSONObject media = new JSONObject();
    media.put("type", "mp3");
    media.put("src", amazon_link);
    media.put("title", "Listen to your message");
    media.put("artist", "By: utellit for Android");
    media.put("album", "Utellit");
    attachment.put("media", new JSONArray().put(media));
} catch (JSONException e1) {}

try {
    attachment.put("message", "Messages");
    attachment.put("name", "Get utellit to send messages like this!");
    attachment.put("href", link);
} catch (JSONException e) {}
parameters.putString("attachment", attachment.toString());
parameters.putString("message", "Text is lame. Listen up:");
parameters.putString("target_id", "xxxx");  // target Id to post
parameters.putString("method", "stream.publish");
String  response = facebook.request(parameters);       
}

catch(Exception e){}

In facebook.request method we should send only parameters and the Method of post should added in Attachments

Finally my Post in Facebook looks likes this :