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)!
PhoneGap now has an official Facebook plugin. Use that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With