Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my Facebook AppInviteDialog request not being received by target friend?

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:

screenshot

I then click next, select one or more friends and click the top right Send button:

screenshot

The result is a seemingly successful send:

screenshot

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:

  • App is only available on android.
  • Notification is not received on any platform including Facebook android app.
  • The App link url has been confirmed working by clicking on it in the Facebook android app. (It creates a popup linking to the Google Play Store)
  • Single Sign On has been enabled and user is logged in, although should not be necessary according to the AppInviteDialog documentation on Facebook.
  • Tried this with the target user not already having authorized the app, and also with user that already had the app installed. Same results.
  • The Facebook SDK version I am using is 4.0.0

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!

like image 807
Joachim Avatar asked Apr 22 '15 12:04

Joachim


1 Answers

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!

like image 122
Joachim Avatar answered Nov 12 '22 17:11

Joachim