在Android中的Facebook发布中命名音频文件的问题 [英] Problem in Naming the Audio file in Facebook Post in Android

查看:121
本文介绍了在Android中的Facebook发布中命名音频文件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,我没有Dialog将音频链接发布到Facebook Friends墙。
我可以在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 ..

以下是我的代码:

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){
}

如果我尝试使用添加附件的JSON数组,在参数中没有添加任何内容,我正在收到如下这样的空文本:

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:

使用JSON ARRAY mu代码是:

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(异常e){}

catch(Exception e){}

facebook.request 方法中,我们应该只发送参数,并且在附件中添加帖子方法

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

最后我在Facebook上的帖子看起来像这样:

Finally my Post in Facebook looks likes this :

这篇关于在Android中的Facebook发布中命名音频文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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