This guide explains how to integrate your app with Facebook using the Facebook Developer Portal for both iOS and Android.
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.
There are many settings involved in configuring your app for Facebook. Locate the proper section within the portal and note the following important settings:
Bundle ID — This must match the App ID Suffix that you use to build your app; it can be retrieved in the App IDs submenu for iOS Apps within the Apple Developer portal. Here, use the same com.mycompany.myapp
. Do not attempt to use a wildcard App ID.
URL Suffix Schemes — Specify these if you want to use specific URL scheme suffixes when publishing your iOS apps. See here for details on how to configure this in build.settings
.
iPhone Store ID / iPad Store ID — These are received when you add your app to the iTunes Connect portal, even prior to uploading the binary. 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.
An iPhone Store ID or iPad Store ID must be provided to receive game requests sent from the Game Request Dialog.
Single Sign On — Set this to YES.
Deep Linking — Set this to YES to enable 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.
Google Play Package Name — Use the same package name that you’ve entered into Corona’s build window.
Class Name — This 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 — These 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, have a Facebook app installed, and try to run your app, Facebook will produce an error and print the key hash it expects. You can then add this new key hash to the Facebook Developer Portal.
Single Sign On — Set this to YES.
Deep Linking — Set this to YES to enable 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.
While your Facebook-integrated app is in development, it’s important that you interact with and test your app using only registered Facebook accounts. See the Roles section of the Facebook Developer Portal for more info.
Similarly, your app should not be in the “Live” state while testing. If your app uses permissions that require review by Facebook, those permissions will not be granted to your app until the review from Facebook takes place. Leaving your app in the “In Development” state will allow you to test using permissions that fall into this category.
To ensure your app is in the “In Development” state, go to the App Review section of the developer portal and ensure that the
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.