Air Native Extension (iOS and Android) for the Facebook mobile SDK
ActionScript Objective-C Java C Ruby
Clone or download
Latest commit 7a255b9 Jun 14, 2018

README.md

Air Native Extension for Facebook (iOS + Android)

This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by FreshPlanet and is used in the game SongPop 2.

Facebook SDK Versions

  • iOS: 4.19.0
  • Android: 4.19.0

Installation

The ANE binary (AirFacebook.ane) is located in the bin folder. You should add it to your application project's Build Path and make sure to package it with your app (more information here). See it within our sample project's app descriptor here.

<extensions>
    ...
    <extensionID>com.freshplanet.ane.AirFacebook</extensionID>
</extensions>

iOS

Be sure to follow steps 1 and 4 of the Getting Started with the Facebook SDK for iOS guide.

Check out the sample project here for app descriptor inclusions.

Android

You will need to add the following activities and permission in your application descriptor:

<android>
    ...
    <manifestAdditions><![CDATA[
        <manifest android:installLocation="auto">
            ...
            <uses-permission android:name="android.permission.INTERNET"/>
            <application>
                ...
                <meta-data android:name="com.facebook.sdk.ApplicationId" 
                           android:value="fb{YOUR_FB_APPLICATION_ID}"/>

                <activity android:name="com.facebook.FacebookActivity" 
                          android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="{YOUR_FB_APPLICATION_NAME}" />

                <activity android:name="com.freshplanet.ane.AirFacebook.LoginActivity" 
                          android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" />

                <!-- If you're sharing links, images or video via the Facebook for Android app, you also need to declarthe   FacebookContentProvider in the manifest. -->
                <provider android:authorities="com.facebook.app.FacebookContentProvider{YOUR_FB_APPLICATION_ID}" 
                          android:name="com.facebook.FacebookContentProvider" 
                          android:exported="true"/>
            </application>
        </manifest>
    ]]></manifestAdditions>
</android>

You can check out our example of this in our sample project here.

NOTE: It is important to prefix YOUR_FB_APP_ID with "fb" in <meta-data> (and ONLY in <meta-data>) tag, because obug in Android manifest file (http://stackoverflow.com/questions/16156856/android-facebook-applicationid-cannot-be-null)Facebook SDK code in this ANE was modified to recognize FB_APP_ID prefixed with "fb".

Using the ANE

Once installed you can initialize the ANE...

Facebook.instance.init("0123456789", _initCallback);

and it will be ready to go! Check out our sample code to aid you.

Build from source

Should you need to edit the extension source code and/or recompile it, you will find an ant build script (build.xml) in the build folder:

cd /path/to/the/ane

# Setup build configuration
cd build
mv example.build.config build.config
# Edit build.config file to provide your machine-specific paths

# Build the ANE
ant

Authors

This ANE has been written by Thibaut Crenn, Alexis Taugeron, Renaud Bardet, and Adam Schlesinger. Rewrites and modifications to version SDK 4.x were made by Ján Horváth.