Reputation: 896
Hello everyone i'm trying to use the Facebook Api to send a notification and i did this:
Bundle params = new Bundle();
params.putString("to", 535465135216);
params.putString("message", "Prova Prova A A");
facebook.dialog(Answer.this, "apprequests", params, new DialogListener() {
public void onComplete(Bundle values) {
Toast toast = Toast.makeText(getApplicationContext(), "Done",
Toast.LENGTH_SHORT);
toast.show();
}
@Override
public void onFacebookError(FacebookError error) {
Toast.makeText(getApplicationContext(), "Facebook Error: " + error.getMessage(),
Toast.LENGTH_SHORT).show();
}
@Override
public void onCancel() {
Toast toast = Toast.makeText(getApplicationContext(), "App request cancelled",
Toast.LENGTH_SHORT);
toast.show();
}
@Override
public void onError(DialogError e) {
// TODO Auto-generated method stub
}
});
And when i try to run this project everything work well and it shows the Toast "Done" but in my Facebook Profile doesn't appear the notification.
Should I change something in Facebook App's settings ?
ThankYou :)
Upvotes: 3
Views: 1197
Reputation: 48006
Many times when invites are successfully sent but do not appear for the user it is because a canvas url was not set in the application settings.
The canvas url parameter is crucial when dealing with application invites/requests because when a user takes action on the invite (that means clicks "accept"), he is redirected to your application. If no canvas url is supplied, the invitation essentially becomes nullified because Facebook has no where to send the user after they click!
You are developing an android application so you might not even need a canvas url but in order to get the invitations working correctly, you'll have to specify one.
Another possibility is that you are sending the invite/request to a user that is not defined in the "roles" of your application when your app is still set to "sandbox mode". As long as your app remains in sandbox mode it is essentially invisible to anyone not defined in the "roles" section. This sandbox mode allows developers to develop and test their application without having to worry about making it public on Facebook. So you'll be able to send the invite, but if you send it to someone who is not defined and involved in the development of the app, s/he will simply not get the invite (even though the action will seem that it was successful).
Upvotes: 10