Reputation: 5212
some time ago I found a way to share my app on facebook using this:
How can I post link on facebook from android app using FB API?
for some reason now I get this error:
An error occurred. Please try again later.
API Error Code: 1
API Error Description: An Unknown error Occurred
Error Message: kError 1357038: Sorry, Something went wrong: Please try closing and re-opening your browser window.
Do you have any idea why this happens?
Upvotes: 4
Views: 2745
Reputation: 5212
I found the reason for the error. After I implemented this with the new I (It took me some time...) I found more parameters for the feed like "description" and "caption".
The reason for the error is that you have to include description in the feed, like this:
private void postToWall() {
Bundle parameters = new Bundle();
parameters.putString("name", "Name");
parameters.putString("description", "description");
parameters.putString("link", "Link");
parameters.putString("picture", "Picture");
parameters.putString("display", "page");
facebookClient.dialog(MainActivity.this, "feed", parameters, new DialogListener() {
@Override
public void onFacebookError(FacebookError e) {
LogFileHandler.writeToLog(e.getMessage());
}
@Override
public void onError(DialogError e) {
LogFileHandler.writeToLog(e.getMessage());
}
@Override
public void onComplete(Bundle values) {
}
@Override
public void onCancel() {
Toast.makeText(getApplicationContext(), "Published Cancelled", Toast.LENGTH_SHORT).show();
}
});
}
You can also add
parameters.putString("caption", "caption");
if you leave the value field (parameters.putString(key, value);
) empty (or "") or don't include caption it will put garbage text from the link you provided. If you want that it will ignore the caption, just put in the value field " " (space)
Also you can't add description like this:
parameters.putString("description", "");
The value field must be at least " " (space) (and then it will ignore it)
Here you can find all the parameter you can use with Facebook feed
Hope you will understand all of this :) if not just try to run the things I talked about and you will see.
Update:
If you try to use it with fragments try this
Upvotes: 4