This air native extension is your best solution to integrate Facebook SDK into your AdobeAir apps
ActionScript Batchfile
Latest commit 305214c Dec 5, 2016 @myflashlab included Bolts
included the Bolts.framework to the frameworks zip file.
Permalink
Failed to load latest commit information.
FD V4.17.0 Nov 10, 2016
ChangeLog.txt fixed change log Nov 18, 2016
FB_SDK_FRAMEWORKS.zip included Bolts Dec 5, 2016
README.md fixed change log Nov 18, 2016

README.md

Facebook SDK ANE V4.17.0 (Android + iOS)

This extension is the cleanest and the most easy to work with Facebook API you can find online. don't take my word for it. download it for free and test it for yourself. this will be your best solution to integrate Facebook into your Adobe AIR apps.

Main features:

  • Login/logout
  • ask users for permissions
  • decide on your app logic based on granted permissions
  • Share URL links directly from your app
  • create Facebook like button and place it inside your AIR app
  • send App Invite to friends
  • Support App Events for use in Facebook analytics
  • full access to Facebook Graph API... the sky is the limit!
  • works on Android and iOS with an identical AS3 library

asdoc

find the latest asdoc for this ANE here.

Demo .apk

you may like to see the ANE in action? Download demo .apk

NOTICE: the demo ANE works only after you hit the "OK" button in the dialog which opens. in your tests make sure that you are NOT calling other ANE methods prior to hitting the "OK" button. Download the ANE

AIR Usage

Login sample. find more samples in repository
FB.getInstance("000000000000000"); // facebook app ID you received from your Facebook API console
if(FB.os == FB.ANDROID) trace("hash key = ", FB.hashKey); // required once for Android only

FB.auth.addEventListener(FBEvent.LOGIN_DONE, onLoginSuccess);
FB.auth.addEventListener(FBEvent.LOGIN_CANCELED, onLoginCanceled);
FB.auth.addEventListener(FBEvent.LOGIN_ERROR, onLoginError);

// an array of permissions. you can add or remove items from this array anytime you like
FB.auth.requestPermission(Auth.WITH_READ_PERMISSIONS, Permissions.public_profile, Permissions.user_friends, Permissions.email);

function onLoginSuccess(event:FBEvent):void
{
    FB.auth.removeEventListener(FBEvent.LOGIN_DONE, onLoginSuccess);
    FB.auth.removeEventListener(FBEvent.LOGIN_CANCELED, onLoginCanceled);
    FB.auth.removeEventListener(FBEvent.LOGIN_ERROR, onLoginError);

    trace("onLoginSuccess");
    trace("token = " + FB.auth.token);
    trace("permissions = " + FB.auth.permissions);
    trace("declined Permissions = " + FB.auth.declinedPermissions);
}

function onLoginCanceled(event:FBEvent):void
{
    FB.auth.removeEventListener(FBEvent.LOGIN_DONE, onLoginSuccess);
    FB.auth.removeEventListener(FBEvent.LOGIN_CANCELED, onLoginCanceled);
    FB.auth.removeEventListener(FBEvent.LOGIN_ERROR, onLoginError);

    trace("onLoginCanceled");
}

function onLoginError(event:FBEvent):void
{
    FB.auth.removeEventListener(FBEvent.LOGIN_DONE, onLoginSuccess);
    FB.auth.removeEventListener(FBEvent.LOGIN_CANCELED, onLoginCanceled);
    FB.auth.removeEventListener(FBEvent.LOGIN_ERROR, onLoginError);

    trace("onLoginError = " + event.param);
}

AIR .xml manifest

  <android>
    <manifestAdditions>
        <![CDATA[<manifest android:installLocation="auto">
        <uses-permission android:name="android.permission.WAKE_LOCK" />
        <uses-permission android:name="android.permission.INTERNET" />

        <application android:hardwareAccelerated="true" android:allowBackup="true">
            <activity android:hardwareAccelerated="false">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
                <intent-filter>
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.BROWSABLE" />
                    <category android:name="android.intent.category.DEFAULT" />

                    <!-- Your application scheme. read here for more information: http://www.myflashlabs.com/open-adobe-air-app-browser-pass-parameters/ -->
                    <data android:scheme="air.com.doitflash.exfacebook2" />
                </intent-filter>
            </activity>



            <!-- This is required for logging in -->
            <activity android:name="com.facebook.FacebookActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
            <activity android:name="com.doitflash.facebook.access.MyLogin" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@style/Theme.Transparent" />

            <!-- This is required for sharing https://developers.facebook.com/docs/sharing/android -->
            <provider android:authorities="com.facebook.app.FacebookContentProvider000000000000000" android:name="com.facebook.FacebookContentProvider" android:exported="true"/>
            <activity android:name="com.doitflash.facebook.sharing.MyShare" android:theme="@style/Theme.Transparent" />

            <!-- This is required for app invite feature -->
            <activity android:name="com.doitflash.facebook.invite.MyInvite" android:theme="@style/Theme.Transparent" />

        </application>

</manifest>]]></manifestAdditions>
  </android>
  <iPhone>
    <!-- A list of plist key/value pairs to be added to the application Info.plist -->
    <InfoAdditions>
        <![CDATA[<key>MinimumOSVersion</key>
        <string>8.0</string>

        <key>UIStatusBarStyle</key>
        <string>UIStatusBarStyleBlackOpaque</string>

        <key>UIRequiresPersistentWiFi</key>
        <string>NO</string>

        <key>FacebookAppID</key>
        <string>000000000000000</string>

        <key>FacebookDisplayName</key>
        <string>Air Native Extension</string>

        <key>CFBundleURLTypes</key>
        <array> 
            <dict>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>fb000000000000000</string>

                    <!-- Your application scheme. read here for more information: http://www.myflashlabs.com/open-adobe-air-app-browser-pass-parameters/ -->
                    <string>air.com.doitflash.exfacebook2</string>
                </array>
            </dict>
        </array>

        <key>LSApplicationQueriesSchemes</key>
        <array>
            <string>fbapi</string>
            <string>fb-messenger-api</string>
            <string>fbauth2</string>
            <string>fbshareextension</string>
        </array>

        <key>NSPhotoLibraryUsageDescription</key>
        <string>My description about why I need this feature in my app</string>

        <key>UIDeviceFamily</key>
        <array>
            <!-- iPhone support -->
            <string>1</string>
            <!-- iPad support -->
            <string>2</string>
        </array>]]></InfoAdditions>

    <requestedDisplayResolution>high</requestedDisplayResolution>
  </iPhone>



  <extensions>

    <!-- The following dependency ANEs are only required when compiling for Android -->
    <extensionID>com.myflashlab.air.extensions.dependency.overrideAir</extensionID>
    <extensionID>com.myflashlab.air.extensions.dependency.androidSupport</extensionID>

    <extensionID>com.myflashlab.air.extensions.facebook</extensionID>
  </extensions>

Requirements:

  1. This ANE is dependent on androidSupport.ane and overrideAir.ane You need to add these ANEs to your project too. Download them from here:
  2. Compile with Air SDK 24 or above.
  3. To compile on iOS, you will need to add the Facebook frameworks to your Air SDK.
    • download FB_SDK_FRAMEWORKS.zip package from our github and extract them on your computer.
    • you will see some xxxxxx.framework files. just copy them as they are and go to your AdobeAir SDK.
    • when in your Air SDK, go to "\lib\aot\stub". here you will find all the iOS frameworks provided by Air SDK by default.
    • paste the facebook frameworks you had downloaded into this folder and you are ready to build your project.
  4. Android SDK 15 or higher
  5. iOS 8.0 or higher
  6. When compiling on Android, make sure you are always compiling in debug or captive mode. shared mode won't work because in the extension we have overwritten some Adobe classes for the extension to work properly.

Commercial Version

http://www.myflashlabs.com/product/facebook-ane-adobe-air-native-extension/

Facebook SDK ANE

Tech Details

  • When compiling on Android, rarely, randomly you may see a compilation error! Just try again and it will be fine. It's a bug on Adobe's side as explained here
  • From V4.11.0 of this ANE, Facebook is forcing Safari View Controller (SVC) instead of fast-app-switching (FAS) for the iOS side. Read the official blog about this

Tutorials

How to embed ANEs into FlashBuilder, FlashCC and FlashDevelop
Understanding how Facebook SDK works in general
Creating a Facebook application. A place for your app to connect to
Connecting your FB app to your mobile app with a hash key
Managing login/out and asking permissions from users
Generating real Facebook Like buttons in your apps
Knowing how to share content from your app
Understanding Facebook Graph API. how to request for information
Setting up the Air manifest .xml file for Android and iOS
Compiling requirements on Android and iOS

Changelog

Nov 10, 2016 - V4.17.0

  • Optimized for manual permissions required by AIR SDK 24+
  • Min AIR SDK 24 to compile this ANE with swf-version set to 35
  • updated the core facebook SDK to V4.17.0 - Make sure to update your current Facebook frameworks for iOS
  • Min iOS to support this version is 8.0
  • Login activity has changed to:
<activity android:name="com.facebook.FacebookActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
  • You no longer need to whitelist Facebook domains.
  • Add Usage Description for PhotoLibrary by the Facebook SDK
<key>NSPhotoLibraryUsageDescription</key>
<string>My description about why I need this feature in my app</string>
  • Make sure to update the common dependencies: overrideAir and androidSupport to the latest version
  • The FB.graph.request() method and the FB.graph.version property is now depricated. Instead use the FB.graph.call() method and pass in the graph version directly:
FB.graph.addEventListener(FBEvent.GRAPH_RESPONSE, onGraphResponse);
FB.graph.addEventListener(FBEvent.GRAPH_RESPONSE_ERROR, onGraphError);
FB.graph.call("https://graph.facebook.com/v2.8/me", URLRequestMethod.GET, new URLVariables("fields=name,email,picture&metadata=0"));

May 16, 2016 - V4.11.0

  • updated the core facebook SDK to V4.11.0
  • Support Android API 15 or higher
  • your app must be compiled with Air SDK 22 or higher
  • Added App Events support FB.logEvent(eventName, sum, params)
  • Using Graph API v2.6
  • FB.logManager is now deprecated. you should use FB.auth instead
  • Updated the whitelist for facebook on iOS side of the manifest
  • From FB SDK 4.6 and higher, FB is forcing Safari View Controller (SVC) instead of fast-app-switching (FAS). It seems like a pain not to have the fast-app-switching anymore but Facebook says, this is actually a good thing! Read here for more details
  • The iOS frameworks are updated to V4.11.0 FB_SDK_FRAMEWORKS.zip
  • Added event.graphRequest to FBEvent.GRAPH_RESPONSE and FBEvent.GRAPH_RESPONSE_ERROR so you will know what request to the graph you had sent previously
  • Some minor bug fixes

Jan 20, 2016 - V3.9.2

Dec 20, 2015 - V3.9.1

  • minor bug fixes

Nov 02, 2015 - V3.9

  • doitflash devs merged into MyFLashLab Team

Sep 08, 2015 - V3.0

Jul 31, 2015 - V2.0

  • Added iOS support
  • Minor bug fixes on Android side

Jul 17, 2015 - V1.0

  • beginning of the journey!