10

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?

user2924127
  • 6,034
  • 16
  • 78
  • 136

1 Answers1

1

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);
    }
);
André Bonna
  • 807
  • 8
  • 13
  • Bonna, any help you could lend would be amazing as I'm stuck on it and the example you show does not fit with the Ionic-Native plugin. https://ionicframework.com/docs/v2/native/facebook/ – rashadb Dec 23 '16 at 08:09
  • Sorry @rashadb I just tried my solution on ionic framework v1. I would like to start working with the new version but I still didn't take the time for it. – André Bonna Dec 23 '16 at 09:13
  • @Bonna, I just put FB on my tablet yesterday; new tablet. It wouldn't work because somehow an old FB was downloaded on it?!? When I updated it today it all worked just fine. – rashadb Dec 23 '16 at 11:58