Facebook for Android

A simple and complete plugin for facebook for Android . With examples in C# ad JS that show the majority of the functions !!!. You will need to setup your an app at http://www.facebook.com/developers/apps.php. Once your application is setup, you will need to Call FacebookPlugin.Init(FB_ID) with your Application ID and after you will successfully be able login (call FacebookPlugin.login()) and post to the user’s wall .

Methods :
init
login
logout
postMessageOnWall
postMessageOnWallDialog
postImageOnWall
postImageOnWallPath
isLoggedIn
getFriend
getPlayerNameId

Link to Facebook for Android

EDIT

Sorry for the post in “Assets and Asset Store”

The screenshots in the store show the Unity icon where the facebook icon usually is in the dialogs.

Why is this?

It is the standard icon of Unity , Change your game icon and you will see your .

Do you have this problem with our plugin ?

I know it is the Unity icon. I’m wondering why you decided to replace the facebook icon.

EDIT: I should stop beating around the bush. I bet you changed it because you had the same problem I had when working on integrating Facebook. You got a resource not found error resource not found error and instead of finding a way to put the proper icon in there you edited the facebook code to put the only resource you had access to.

I’m concerned that Facebook will have problems with people replacing their icon. It also messes up the dialog putting in a 64x64 icon in place of a 14x14 icon.

Now I’m not an expert with all this stuff yet but looking at the file list for your package it doesn’t look like you’ve extended the UnityPlayerActivity Which would mean you haven’t overridden the ‘onActivityResult’ which the Facebook Android SDK Getting Started Guide says you need to do for the Single-Sign-On feature to work. If you don’t support that you should probably say that or at least not claim that your package is a “complete plugin for facebook for Android”.

I’m sorry if I’m coming across as a bit harsh but you are charging people for this and the above concerns certainly stopped me from considering purchasing it.

Has anyone used this package, and if so, what were you results? I notice it’s a lot less featured the the Prime31 Iphone plugin (no graph access etc).

I really need the user auth token - can’t find a way to get it though.

For anyone else who purchases this, you can add the following to FacebookPlugin.cs and you’ll have access to the auth token. It also shows you how you can access most of the facebook API if you want to do other things:

public string getAuthToken()
{
if (Application.platform != RuntimePlatform.Android) return string.Empty;
AndroidJavaObject facebookObj = cls_fb.CallStatic(“getFacebook”);
if (null != facebookObj)
{
return facebookObj.Call(“getAccessToken”);
}
return string.Empty;
}

nice Fooo,
Can you access the Graph API with this and the WWWform?

Edit, fixed

I bought the FB for Android from the Assets Store.
I’m trying to get the session, is it possible? how?

Also, I want to select permissions, how can I do that?
(I don’t want the “publish_stream”)

Thanks!

About the session and Access Token.
Aparently, you can create the session from the AT, with that, you can check let users log in to your servers with facebook.
If you use the Facebook PHP SDK, when you check for session, and you only have AT, you can use this:

after this line of code:

$session = $facebook->getSession();

use this:

if (!$session) {
ATexplode1=explode("|",_REQUEST[“access_token”]);
$ATexplode2=str_split($ATexplode1[1],strrpos($ATexplode1[1],“-”)+1);
$ATexplode3=explode(“.”,$ATexplode2[0]);
$session = array(
“session_key” => $ATexplode1[1],
“uid” => $ATexplode2[1],
“expires” => ATexplode3[3], "access_token" => _REQUEST[“access_token”]);
ksort($session);
$sessionStr = “”;
foreach($session as $sessionKey => $sessionValue) $sessionStr .= implode(“=”, array($sessionKey, $sessionValue));
$session[“sig”] = md5($sessionStr.“”);
ksort($session);
$facebook->setSession($session);
$session = $facebook->getSession();
}

for older versions of the PHP SDK, this link might help:
http://sambro.is-super-awesome.com/2010/05/28/facebook-access-tokens-from-canvas-apps/

also, I didn’t fully tested it yet, so there might be some problems

I still trying to figure out ,how can I choose which permission to ask from the user with this FB for Android plugin.