Facebook

$ ionic cordova plugin add cordova-plugin-facebook-connect --variable APP_ID="123456789" --variable APP_NAME="myApplication"
$ npm install @awesome-cordova-plugins/facebook

Plugin Repo: https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connectarrow-up-right

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

Requires Cordova plugin: cordova-plugin-facebook-connect. For more info, please see the Facebook Connectarrow-up-right.

Installation

To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at https://developers.facebook.com/appsarrow-up-right.

fb-getstarted-1arrow-up-right

Retrieve the App ID and App Name.

fb-getstarted-2arrow-up-right

Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.

 ionic cordova plugin add cordova-plugin-facebook-connect --variable APP_ID="123456789" --variable APP_NAME="myApplication"

After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:

fb-getstarted-3arrow-up-right

Click 'Add Platform'.

fb-getstarted-4arrow-up-right

At this point you'll need to open your project's config.xmlarrow-up-right file, found in the root directory of your project.

Take note of the id for the next step:

You can also edit the id to whatever you'd like it to be.

iOS Install

Under 'Bundle ID', add the id from your config.xml file:

fb-getstarted-5arrow-up-right

Android Install

Under 'Google Play Package Name', add the id from your config.xml file:

fb-getstarted-6arrow-up-right

And that's it! You can now make calls to Facebook using the plugin.

Events

App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.

Activation events are automatically tracked for you in the plugin.

Events are listed on the insights pagearrow-up-right.

For tracking events, see logEvent and logPurchase.

Supported platforms

  • Android

    • iOS

    • Browser

Last updated

Was this helpful?