Haxe OpenFL extension for Facebook, supports Facebook SDK for Android and iOS. On other platforms uses Facebook REST API and logins using a Webview.
###How to Install
To install this library, you can simply get the library from haxelib like this:
haxelib install extension-facebook
Once this is done, you just need to add this to your project.xml
<setenv name="FACEBOOK_APP_ID" value="7699999960641202" /> <!-- your facebook app ID -->
<setenv name="FACEBOOK_DISPLAY_NAME" value="SuperGame!" /> <!-- your game name -->
<haxelib name="extension-facebook" />
##Usage example
Login the user to Facebook if needed:
var facebook = new Facebook();
facebook.init(function(value:Bool){trace("Init Callback");});
if (facebook.accessToken!="") { // Only login if the user is not already logged in
onLoggedIn();
} else {
facebook.login( // Show login dialog
PermissionsType.Read,
["email", "user_likes"],
onLoggedIn,
onCancel,
onError
);
}
Send app invite:
// See https://developers.facebook.com/docs/applinks
AppInvite.invite("https://fb.me/1654475341456363");
Share a link on the users timeline:
Share.link(
"<a link to something>",
"<title>",
"<link to an image>",
"<description>"
);
Graph API:
facebook.get(
"/me/permissions", // Graph API endpoint
onSuccess, // Dynamic->Void
onError // Dynamic->Void
);
##License
The MIT License (MIT) - LICENSE.md
Copyright © 2012 SempaiGames (http://www.sempaigames.com)
Author: Daniel Uranga