Giter Club home page Giter Club logo

facebook-ane's Introduction

Facebook SDK ANE V3.9.2 (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
  • full access to Facebook Graph API... the sky is the limit!
  • works on Android and iOS with an identical AS3 library

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

     FB.getInstance("000000000000000"); // facebook app ID you received from your Facebook API console
     trace("hash key = ", FB.hashKey); // required once for Android only

     FB.logManager.addEventListener(FBEvent.LOGIN_DONE, onLoginSuccess);
     FB.logManager.addEventListener(FBEvent.LOGIN_CANCELED, onLoginCanceled);
     FB.logManager.addEventListener(FBEvent.LOGIN_ERROR, onLoginError);
     
     // an array of permissions. you can add or remove items from this array anytime you like
     FB.logManager.requestPermission(LogManager.WITH_READ_PERMISSIONS, Permissions.public_profile, Permissions.user_friends, Permissions.email);
     
     function onLoginSuccess(event:FBEvent):void
     {
         FB.logManager.removeEventListener(FBEvent.LOGIN_DONE, onLoginSuccess);
         FB.logManager.removeEventListener(FBEvent.LOGIN_CANCELED, onLoginCanceled);
         FB.logManager.removeEventListener(FBEvent.LOGIN_ERROR, onLoginError);
         
         trace("onLoginSuccess");
         trace("token = " + FB.logManager.token);
         trace("permissions = " + FB.logManager.permissions);
         trace("declined Permissions = " + FB.logManager.declinedPermissions);
     }
     
     function onLoginCanceled(event:FBEvent):void
     {
         FB.logManager.removeEventListener(FBEvent.LOGIN_DONE, onLoginSuccess);
         FB.logManager.removeEventListener(FBEvent.LOGIN_CANCELED, onLoginCanceled);
         FB.logManager.removeEventListener(FBEvent.LOGIN_ERROR, onLoginError);
         
         trace("onLoginCanceled");
     }
     
     function onLoginError(event:FBEvent):void
     {
         FB.logManager.removeEventListener(FBEvent.LOGIN_DONE, onLoginSuccess);
         FB.logManager.removeEventListener(FBEvent.LOGIN_CANCELED, onLoginCanceled);
         FB.logManager.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" />
					<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="@style/Theme.Transparent" />
			<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>6.1</string>
		
		<key>UIStatusBarStyle</key>
		<string>UIStatusBarStyleBlackOpaque</string>
		
		<key>UIRequiresPersistentWiFi</key>
		<string>NO</string>
		
		<key>UIFileSharingEnabled</key>
		<string>NO</string>
		
		<key>UIPrerenderedIcon</key>
		<true />
		
		<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>
					<string>air.com.doitflash.exfacebook2</string>
				</array>
			</dict>
		</array>
		
		<key>UIDeviceFamily</key>
		<array>
			<!-- iPhone support -->
			<string>1</string>
			<!-- iPad support -->
			<string>2</string>
		</array>]]></InfoAdditions>
		
    <requestedDisplayResolution>high</requestedDisplayResolution>
  </iPhone>

Requirements:

  1. you will need to add commonDependenciesV4.0.ane to your project.
  2. Compile with Air SDK 18 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.
  1. Android SDK 11 or higher
  2. iOS 6.1 or higher
  3. When compiling on Android, make sure you are always compiling in 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, sometimes, 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 below.
  • When compiling with commonDependenciesV4.0.ane you will notice that your project compile time will take longer than usual (specially if you are on a windows 32-bit). unfortunately this happens because V4.0 of our dependency ane is using the latest version of Google services and Adobe compiler takes just too much time to compile .apk! we are hoping that Adobe will fix this issue soon with the new Air SDK. we have already reported this on Adobe forums: https://forums.adobe.com/thread/1948895

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

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!

facebook-ane's People

Contributors

myflashlab avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.