Reputation: 349
I'm trying to integrate Facebook 'Like' button into my Phonegap app (iOS and Android). The easiest way is to c&p the same code as for simple web site:
<iframe src="http://www.facebook.com/plugins/like.php?..."...>></iframe>
It works perfectly (just like for normal web site) if user already logged in. But if I log out from FB and then try to tap "Like" button I will be redirected to the FB login page and bad thing is that this page will be opened in new native browser window. So, after login it will not redirect me back to the app. And also, if there is a way to open login page inside my app I think there still will be a problem with redirecting back to my app from FB (i.e. redirect to the local .html file)...
So, is there ANY way for Phonegap app to integrate with FB 'Like' feature somehow?
Upvotes: 3
Views: 2620
Reputation: 603
I don't think this is possible yet. The PhoneGap Facebook Connect plugin has promise, but at the time of writing this it still has a few niggles that would stop me deploying it - it's only been released for a week or two and it seems to have broken so second and subsequent logins to an app won't work. It seems like it will be really useful soon, but it's more volatile than even the standard volatility level of most Facebook integrations as it stands. Getting it to build against PhoneGap 1.1.0 yesterday also involved digging through issues in github and patching the Facebook SDK... so you'll have fun with that.
As far as I can see it doesn't support dialogs or social plugins yet, though for the base Facebook Connect use case it does solve the problem where Facebook users can be redirected out of your PhoneGap app to login either in the FB app or Safari and then bounced back into your app afterwards. It sounds like the plugin authors are working on more features, so I'll be keeping an eye on the project.
Upvotes: 1
Reputation: 5647
It sounds like you need the PhoneGap Facebook Connect plugin:
https://github.com/davejohnson/phonegap-plugin-facebook-connect
From the README:
"The Facebook Connect plugin for PhoneGap allows you to use the same JavaScript code in your web application as you use in your native PhoneGap application, but your native PhoneGap application will use the Facebook native app to perform single sign on (SSO) for the user."
Upvotes: 0