Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facebook app invite using ionic (cordova phonegap)

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?

like image 205
user2924127 Avatar asked Oct 05 '15 20:10

user2924127


People also ask

How do I add Facebook login to Ionic?

Setup a Facebook app. Create a New Ionic Angular App. Install Ionic Native Facebook Connect Plugin. Implement Facebook Login and Logout.

Can I use Ionic with Cordova?

While developers can still use Cordova in the Ionic stack, the future is Ionic with Capacitor (or Capacitor on its own with any popular web stack!). These apps are known as Web Native apps, in contrast to the older hybrid approach.

What is the difference between PhoneGap Cordova and Ionic?

PhoneGap is an Adobe product which is powered by Apache Cordova. Ionic is a framework which is a set of CSS classes and a JavaScript library, build on top of Cordova with AngularJS.

Can Cordova be used without Ionic?

You cannot access any device-specific feature in Ionic without using Apache Cordova. Apache Cordova allows you to integrate the plugins which can add the functionality to access those features. However, there are many plugins available to cover most of the native functionalities.


1 Answers

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);
    }
);
like image 196
André Bonna Avatar answered Nov 09 '22 05:11

André Bonna