In short: Everything seems to be working on the client side, but nothing received for the Facebook target friend.
These are the detailed steps with code and screenshots:
AppInviteContent content = new AppInviteConent.Builder()
.setApplinkUrl("App link url created via the Facebook AppLink creator tool")
.setPreviewImageUrl("http://www.redacted.com/previewImage.png")
.build();
appInviteDialog.show(this, content);
This results in a dialog being shown with a preview of a link to the install of the app, and the option of entering a message at the top:
I then click next, select one or more friends and click the top right Send button:
The result is a seemingly successful send:
I attached a callback as well to make sure it was actually a successful send:
appInviteDialog.registerCallback(facebookCallbackManager, new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(AppInviteDialog.Result result) {
Log.d(TAG,"onSuccess result = "+ result.getData().toString());
}
@Override
public void onCancel() {}
@Override
public void onError(FacebookException e) {
Log.d(TAG,"onError message = "+ e.getMessage());
}
});
This prints out "onSuccess result = Bundle[{didComplete=1}]"
Expected result: Friend receives a notification. Actual result: Friend receives nothing.
Some more information that might be helpful:
It's frustrating because everything seems OK, and there is no way (that I know of) to debug this problem.
I hope someone can help me or point me in the right direction.
Thank you!
Ok, turns out everything was working fine after all. My mistake was in assuming not having the app installed, and not having the app authorized should generate a push notification.
After creating a new test user, using a device where the app was not currently installed and the app NEVER having been authorized with the user.
So the key here is that no push notification will be generated if the app is installed on the target device, even if the user has not authorized the app previously. Also, seemingly, if the user has authorized the app previously, even if it was removed it at some point, it also will not generate a notification.
So if you want to test this, create an entirely new test user and log in on the Facebook app on the platform you are testing on, and make sure the app is not installed on the device.
I think it should still generate a notification despite app being installed, because multiple users might be using the same device, but that's how it seems to be right now.
I'll leave this here in case anyone has a similar problem in the future.
Live long and prosper!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With