Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/myflashlab/facebook-ANE

This air native extension is your best solution to integrate Facebook SDK into your AdobeAir apps
https://github.com/myflashlab/facebook-ANE

Last synced: about 2 months ago
JSON representation

This air native extension is your best solution to integrate Facebook SDK into your AdobeAir apps

Awesome Lists containing this project

README

        

# Facebook SDK ANE (Android + iOS)
Use this AIR Native Extension to implement the latest official Facebook SDK into your AIR applications.

Main features:
* Login/logout
* ask users for permissions
* decide on your app logic based on granted permissions
* Share URL links directly from your app
* send Game Requests 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

[find the latest **asdoc** for this ANE here.](https://myflashlab.github.io/asdoc/com/myflashlab/air/extensions/fb/package-detail.html)

# AIR Usage
###### Login sample. [find more samples in repository](https://github.com/myflashlab/facebook-ANE/tree/master/AIR/src)
```actionscript
import com.myflashlab.air.extensions.fb.*;

Facebook.init("000000000000000");

// Add these listeners right after initializing the ANE but don't call any other method before FacebookEvents.INIT happens
Facebook.listener.addEventListener(FacebookEvents.INIT, onAneInit);
Facebook.listener.addEventListener(FacebookEvents.INVOKE, onAneInvoke);

// You can receive the hashKey for your Android certificate like below.
if (OverrideAir.os == OverrideAir.ANDROID) trace("hash key = ", Facebook.hashKey);

function onAneInvoke(e:FacebookEvents):void
{
trace("onAneInvoke: " + decodeURIComponent(e.deeplink));
}

function onAneInit(e:FacebookEvents):void
{
trace("onAneInit");

// check if user is already logged in or not
_accessToken = Facebook.auth.currentAccessToken;

/*
IMPORTANT: in practice you should let users click on a login button
not logging them automatically.
*/
if(!_accessToken) toLogin();
}

function toLogin():void
{
/*
It is recommended to login users with minimal permissions. Later, whe your app
needs more permissions, you can call "Facebook.auth.login" again with more permissions.

To ask for publish permissions, set the first parameter to "true".
*/

var permissions:Array = [Permissions.public_profile, Permissions.user_friends, Permissions.email];
Facebook.auth.login(false, permissions, loginCallback);

function loginCallback($isCanceled:Boolean, $error:Error, $accessToken:AccessToken, $recentlyDeclined:Array, $recentlyGranted:Array):void
{
if($error)
{
trace("login error: " + $error.message);
}
else
{
if($isCanceled)
{
trace("login canceled by user");
}
else
{
trace("$recentlyDeclined: " + $recentlyDeclined);
trace("$recentlyGranted: " + $recentlyGranted);

_accessToken = $accessToken;

trace("token: " + _accessToken.token);
trace("userId: " + _accessToken.userId);
trace("declinedPermissions: " + _accessToken.declinedPermissions);
trace("grantedPermissions: " + _accessToken.grantedPermissions);
trace("expiredPermissions: " + _accessToken.expiredPermissions);
trace("expiration: " + new Date(_accessToken.expiration).toLocaleDateString());
trace("lastRefresh: " + new Date(_accessToken.lastRefresh).toLocaleDateString());
trace("dataAccessExpirationDate: " + new Date(_accessToken.dataAccessExpirationDate).toLocaleDateString());
}
}
}
}
```

# AIR .xml manifest
```xml



















































]]>


MinimumOSVersion
10.0

UIStatusBarStyle
UIStatusBarStyleBlackOpaque

UIRequiresPersistentWiFi
NO

FacebookAppID
000000000000000

FacebookDisplayName
Air Native Extension

CFBundleURLTypes


CFBundleURLSchemes

fb000000000000000


[PACKAGE_NAME]


LSApplicationQueriesSchemes

fbapi
fb-messenger-api
fb-messenger-share-api
fb-messenger
fbauth2
fbshareextension


NSPhotoLibraryUsageDescription
My description about why I need this feature in my app

UIDeviceFamily


1

2
]]>

high






com.myflashlab.air.extensions.facebook


com.myflashlab.air.extensions.dependency.overrideAir


com.myflashlab.air.extensions.dependency.overrideAir
com.myflashlab.air.extensions.dependency.androidx.arch
com.myflashlab.air.extensions.dependency.androidx.cardview
com.myflashlab.air.extensions.dependency.androidx.core
com.myflashlab.air.extensions.dependency.androidx.design
com.myflashlab.air.extensions.dependency.androidx.lifecycle
com.myflashlab.air.extensions.dependency.androidx.utils


```

# Requirements:
1. This ANE is dependent on the following ANEs. [Download them from here:](https://github.com/myflashlab/common-dependencies-ANE)
- androidx_arch.ane
- androidx_cardview.ane
- androidx_core.ane
- androidx_design.ane
- androidx_lifecycle.ane
- androidx_utils.ane
- overrideAir.ane
- AIR SDK V30+
3. To compile on iOS, you will need to add following Facebook frameworks to your Air SDK.
- download [iOS Facebook SDK](https://github.com/facebook/facebook-objc-sdk/releases/download/v6.5.2/FacebookSDK_Static.zip) package and extract it on your computer.
* FBSDKCoreKit.framework
* FBSDKLoginKit.framework
* FBSDKShareKit.framework
* FBSDKPlacesKit.framework
- you will see some xxxxxx.framework files. copy them as they are and go to your AdobeAIR SDK.
- when in your Air SDK, go to "\lib\aot\stub". there 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 19 or higher
5. iOS 10.0 or higher
6. In case you see the following error messages when compiling for iOS, check out [this video clip](https://www.youtube.com/watch?v=m4bwZRCvs2c) to know how to resolve it.
```
ld: library not found for -lclang_rt.ios
```
or
```
Undefined symbols ___isOSVersionAtLeast
```
7. There's a known bug as follow on windows machines when compiling for iOS. To avoid that, you will need a Mac to compile your project for iOS. We are hoping that Adobe would fix this problem soon so the app can be correctly packaged on Windows machines also. vote up here https://tracker.adobe.com/#/view/AIR-4198557
```
ld: in C:\AIR_SDK\lib\aot/stub/FBSDKCoreKit.framework/FBSDKCoreKit(FBSDKApplicationDelegate.o), unsupported address encoding (A5) of personality function in CIE for architecture arm64
Compilation failed while executing : ld64
```

# Commercial Version
https://www.myflashlabs.com/product/facebook-ane-adobe-air-native-extension/

[![Facebook SDK ANE](https://www.myflashlabs.com/wp-content/uploads/2015/11/product_adobe-air-ane-extension-facebook-2018-595x738.jpg)](https://www.myflashlabs.com/product/facebook-ane-adobe-air-native-extension/)

# Tutorials
* [How to embed ANEs into **FlashBuilder**, **FlashCC** and **FlashDevelop**](https://www.youtube.com/watch?v=Oubsb_3F3ec&list=PL_mmSjScdnxnSDTMYb1iDX4LemhIJrt1O)
* [Usage WIKI](https://github.com/myflashlab/facebook-ANE/wiki)

# Premium Support #
[![Premium Support package](https://www.myflashlabs.com/wp-content/uploads/2016/06/professional-support.jpg)](https://www.myflashlabs.com/product/myflashlabs-support/)
If you are an [active MyFlashLabs club member](https://www.myflashlabs.com/product/myflashlabs-club-membership/), you will have access to our private and secure support ticket system for all our ANEs. Even if you are not a member, you can still receive premium help if you purchase the [premium support package](https://www.myflashlabs.com/product/myflashlabs-support/).