10
votes

I would like to implement Facebook app invite into my mobile app so users can invite their friends to my app. I am using a hybrid framework called Ionic (cordova) but can't find any way to invite friends. There are Facebook plugins from ng-crodova but they do not handle app invites. Is there any plugin or simple solution to get this feature to work?

1
Did you find a solution? I would like to solve this problem as well. - sterne
Any luck trying my answer? - André Bonna

1 Answers

1
votes

You can use this plugin:

https://github.com/jeduan/cordova-plugin-facebook4

Its just a fork of ngCordova Facebook plugin Wizcorp/phonegap-facebook-plugin.

Then you can use appInvite like this:

facebookConnectPlugin.appInvite(
    {
        url: "http://example.com",
        picture: "http://example.com/image.png"
    },
    function(obj){
        if(obj) {
            if(obj.completionGesture == "cancel") {
                // user canceled, bad guy
            } else {
                // user really invited someone :)
            }
        } else {
            // user just pressed done, bad guy
        }
    },
    function(obj){
        // error
        console.log(obj);
    }
);