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

Ionic Facebook插件的安装(Installation)

ionic cordova plugin add cordova-plugin-facebook4 npm install @ionic-native/facebook

Ionic Facebook插件支持的平台(Supported Platforms)

  • Android
  • iOS
  • Browser

Ionic Facebook插件的用法(Usage)

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

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);