Reputation: 477
I have integrated facebook sdk with my native android app. Currently i am trying to open facebook feed dialog from base adapter class and it is showing me error. I have taken reference from the below link.
https://developers.facebook.com/docs/android/feed-dialog https://developers.facebook.com/docs/reference/dialogs/feed/
Everytime it shows me different errors .
I don't know what's wrong with my code. I am also putting my code here.
private void publishFeedDialog() {
Bundle params = new Bundle();
params.putString("name", "Facebook SDK for Android");
params.putString("caption", "Build great social apps and get more installs.");
params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
params.putString("link", "https://developers.facebook.com/android");
params.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(CONTEXT,
Session.getActiveSession(),
params))
.setOnCompleteListener(new WebDialog.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(CONTEXT,
"Posted story, id: " + postId,
Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(CONTEXT,
"Publish cancelled",
Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(getActivity().getApplicationContext(),
"Publish cancelled",
Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(CONTEXT,
"Error posting story",
Toast.LENGTH_SHORT).show();
}
}
})
.build();
feedDialog.show();
}
Upvotes: 3
Views: 858
Reputation: 5234
Try this, Go to the Facebook App. Edit its settings. On the Advanced settings page, disable the "Stream post URL security" option.
How to go.
Go to developers.facebook.com/apps On the left hand side, click your app to select it.
Next to the "Settings" section in the middle column, there's an "Edit Settings" link.
Click that. On the new page, under the "Settings" menu on the left hand side, click "Advanced".
Under the "Migrations" section, find "Stream post URL security". Set it to "Disabled". Click the "Save Changes" button at the bottom of the screen..
It will look something like this
You can see by default this is on just click it OFF and click on Save Changes and then try to clean your project and run it again. Might be this will help you.
Upvotes: 2