Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing the phonegap facebook plugin

I'm trying to install the phonegap plugin for Facebook by Jos downloadable here: https://github.com/jos3000/phonegap-plugins/tree/master/Android/Facebook

I've got the folder structure set up like this:

src/com/facebook/android/*.java
src/com/hipsnip/plugins/facebook/FacebookAuth.java
src/com/my_app/app/App.java
libs/phonegap-1.0.0.jar
/res/xml/plugins.xml
assets/www/index.html facebook.js phonegap-1.0.0.js

I've added the plugin to the plugin.xml file like so:

<plugin name="facebook" value="com.hipsnip.plugins.facebook.FacebookAuth" />

I've added the facebook.js to my index.html, and have the following function (which gets triggered by pressing a button):

function facebook_login()
{
  var appId = "1234"; // this is your facebook app id change me

  window.plugins.facebook.authorize(appId,function(res){
    alert(res.name);
  });
});

}); }

The app opens up a new browser window (I suspect that's what it is) but all it displays is my application without running javascript. LogCat shows the following error:

file:///android_asset/www/index.html: Line 95 : TypeError: Result of expression 'window.plugins.facebook' [undefined] is not an object.

Thanks for any help you can give (I suspect it has to do with the way that I've set up the folders, or the way I've added the plugin.xml, but I really don't have a clue)!

like image 387
NotSimon Avatar asked Sep 09 '11 20:09

NotSimon


1 Answers

PhoneGap now has an official Facebook plugin. Use that.

like image 144
max Avatar answered Oct 18 '22 00:10

max