Facebook Portal Setup

This guide explains how to integrate your app with Facebook using the Facebook Developer Portal for both iOS and Android.

Developer Registration

If you haven't already done so, sign in to the Facebook Developer Portal and register as a developer. This is a simple process and it doesn't involve downloading or installing any software.

Once registered, you must set up your app with Facebook to receive a unique App ID. You can do this even if your app isn't yet complete.

App Integration

There are many settings involved in configuring your app for Facebook. Locate the proper section within the portal and note the following important settings:

iOS

  • Bundle ID must match the App ID Suffix that you use to build your app. This can be retrieved in the App IDs submenu of the iOS Provisioning Portal where you manage your certificates, devices, provisioning, etc. Here, use the same reverse-domain format, for example com.mycompany.myapp. Do not attempt to use a wildcard App ID.

  • iPhone Store ID and/or iPad Store ID are received when you add your app to the iTunes Connect portal, even prior to uploading the binary. For more information about adding an app to iTunes Connect, please view this video. If you haven't yet configured the app within the iTunes store, you can use any existing app ID — just don't forget to change it to the proper ID before you submit the binary to Apple.

  • Single Sign On should be set to YES.

  • Deep Linking should be set to YES. This allows Facebook to use URL schemes to perform specific actions when your app opens. For instance, when the Facebook mobile app launches your app from a link, you will get a launchArgs parameter in your Corona app, from which you can parse an id string.

Android

  • Package Name — use the same package name that you've entered into Corona's build window.

  • Class Name is used for native linking — that is, if someone taps a link to your app in Facebook, it will automatically launch the app. This field must be set to com.ansca.corona.CoronaActivity. Facebook on Android will then launch your app via an Android "intent" using the package name and class name that you've entered on the developer page. The package name (above) is your app's unique string ID and it tells the Android system which app to launch the activity from. As such, there won't be a conflict if more than one Corona app is installed on the same device.

  • Key Hashes are required to integrate Facebook Single Sign-On in your Android app. Instructions on how to generate a key hash can be found here or, alternatively, you can obtain the key hash from Facebook itself. If you enter an incorrect key hash into the Facebook Developer Portal and try to run your app, Facebook will produce an error and print the key hash it expects within your device's console log. To see this, enter adb logcat and look for the error from Facebook. You'll see the key hash there, but it won't be formatted correctly. Thus, copy the string from the log and change any hyphen (-) to a plus sign (+) and change the underscore (_) to a forward slash (/). You can then add this new key hash to the Facebook Developer Portal.

  • Single Sign On should be set to YES.

  • Deep Linking should be set to YES. This allows Facebook to use URL schemes to perform specific actions when your app opens. For instance, when the Facebook mobile app launches your app from a link, you will get a launchArgs parameter in your Corona app, from which you can parse an id string.

Implementing Facebook

Assuming everything is set up as indicated, please proceed to the Implementing Facebook guide which discusses how to implement common Facebook tasks and processes in your app.

Facebook Authentication

For more information about how Facebook authenticates users, see the Understanding Facebook Authentication tutorial.