Git Product home page Git Product logo

extension-facebook's Introduction

extension-facebook

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:

import extension.facebook.Facebook;

var facebook:Facebook = Facebook.getInstance();
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
  );
}

Custom events:

extension.facebook.Facebook.getInstance().setUserID(userID:String);
extension.facebook.Facebook.getInstance().logEvent(eventName:String, jsonPayload:String);
extension.facebook.Facebook.getInstance().trackPurchase(purchaseAmount:Float, currency:String, ?parameters:String)

Send app invite:

// See https://developers.facebook.com/docs/applinks
extension.facebook.AppInvite.invite("https://fb.me/1654475341456363");

Share a link on the users timeline:

extension.facebook.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)

Authors: Daniel Uranga, Joaquín Bengochea & Federico Bricker

extension-facebook's People

Contributors

fbricker avatar dbuscaglia avatar nulld avatar danieluranga avatar smival avatar joackobengochea avatar paulgene avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar Vera Ok 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.