Facebook

Contents

Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android.

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

Stuck on a Cordova issue?

Installation

Community Enterprise
ionic cordova plugin add cordova-plugin-facebook4 npm install @ionic-native/facebook
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More   or   Contact Us
ionic activate-native-ee --key=YOURPRODUCTKEY ionic integrations add @ionic-native/facebook

Supported Platforms

  • Android
  • iOS
  • Browser

Usage

import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook/ngx';

constructor(private fb: Facebook) { }

...

this.fb.login(['public_profile', 'user_friends', 'email'])
  .then((res: FacebookLoginResponse) => console.log('Logged into Facebook!', res))
  .catch(e => console.log('Error logging into Facebook', e));


this.fb.logEvent(this.fb.EVENTS.EVENT_NAME_ADDED_TO_CART);