问题
I have an Android app and I have implemented sharing through Facebook SDK for Android, I am using Feed Dialog
Everything working as written, however, as the content is Audio, I now also want to share MP3 files, just like SoundCloud does. Feed Dialog accepts a "source" parameter, which seems to accept a SWF or MP3 source URL. Feed Dialog feature documentation is here.
However, when I embed Source parameter, it do exactly as it says on tin "If both source and picture are specified, only source is used." However, it don't live up to first promise which is: "The URL of a media file (either SWF or MP3) attached to this post."
My code is below:
private void publishFeedDialog() {
Bundle params = new Bundle();
params.putString("app_id", "xxxxxxxxxxxxxxx");
params.putString("name", "Name of Audio File");
params.putString("caption", "Listen to Audios");
params.putString("description", "Listen Listen Listen");
params.putString("link", "applink on store");
params.putString("picture", "picturehostedsomewhere.png");
params.putString("source", "http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3");
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(this,
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error == null) {
// When the story is posted, echo the success
// and the post Id.
final String postId = values.getString("post_id");
if (postId != null) {
Toast.makeText(getApplicationContext(),
"Shared on Facebook",
Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(getApplicationContext(),
"Publish cancelled",
Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(getApplicationContext(),
"Publish cancelled",
Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(getApplicationContext(),
"Error posting story",
Toast.LENGTH_SHORT).show();
}
}
})
.build();
feedDialog.show();
}
What I see when I share the story is a story without any picture, it's just plain text with link, name, caption and description, no source, no picture, I assume either facebooksdk is having a problem in fetching the source or I am missing something here. I am just wondering where I am heading wrong? Any help please?
来源:https://stackoverflow.com/questions/18032973/posting-an-audio-mp3-file-through-feed-dialog-using-facebook-android-sdk