Hi,
I would like to know if there is a clean way to integrate an existing Ionic application with facebook android sdk. I know there are a few posts about this topic, but none of them lead to the right answer.
I tried several ways, among them Phonegap Facebook Plugin, none of them fully worked. Has someone succesfully integrated them?
Maybe someone could explain me how to make Facebook native Android SDK and Javascript SDK coexist in the same application.
Thanks!
Well, I think I finally got it, in these days I will post the best approach I found to integrate Ionic with Facebook SDK (for Android, I didnât test it with iOS).
It allows the developer to test the app both locally and on the device, using a service wrapper of the Facebook api.
Hi everyone,
Ok, in this github repo branch you will find the solution I came up to Facebook Ionic integration.
On this guide Facebook Cordova Integration you will find a detailed explanation of the process.
However, I have to warn you, itâs not entirely finished the way I would like. I couldnât get the mobile app to use the native Facebook app. Any help with that will be very appreciated.
I think the most important thing here is that you can test your app in the browser as well as in the device. That was the obstacle I was tackling from the beggining.
Please if you have any question feel welcome to ask, that way I can improve my solution and the guide
I have been having trouble implementing your Facebook cordova integration guide for iOS. I feel like I have tried everything. What alternate steps would you recommend when doing this for iOS instead of Anroid?
For starters I would look at phonegap-facebook-plugin documentation on iOS. (I know itâs awfully documented, but itâs what we haveâŚ)
The iOS configuration is different from Androidâs.
Anyway, I believe this week Iâll be having to integrate Ionic with FB SDK for iOS.
Iâll keep you posted.
Thanks, looking forward to it. Iâll do the same.
Hi everyone, the plugin has released a new version with some major changes.
On these days Iâll update my repo with the latest version.
accurso_alan⌠do you have problem of facebook logout problem when using above phonegap-facebook-plugin
error:
âRefused to display âhttps://www.facebook.com/home.phpâ in a frame because it set âX-Frame-Optionsâ to âDENYâ.â
Hi @stevegreat,
Itâs been a while since I made this post and Iâm afraid Iâm not up to date with the FB plugin progress (since the mobile project I was working on is on standby).
However, I would investigate another alternative to integrating Ionic with FB, like Coenraets OpenFB, until a stable release of the plugin is released.
Cheers!
Thank you. most of facebook plugins works well in âloginâ. The problem is if it can totally logout and destroy the session.
Even the plugin like http://coenraets.org/blog/2014/04/sociogram-angularjs-ionic-facebook/ not able to solve logging out of facebook totally.
Some facebook plugin work well without ionic and can logout correctly. but when integrating with ionic it cause problem. Thanks though, once I found out the problem, I will posted back to the forum.
â Sample facebook logout that will destroy the session and cookies
Facebook logout require calling âhttps://www.facebook.com/logout.php?access_token=ACCESS_TOKEN&app_id=APPID&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter%2FdgdTycPTSRj.js%3Fversion%3D41%23cb%3Df2e36ae79c%26domain%3Drun.plnkr.co%26origin%3Dhttp%3A%2F%2Frun.plnkr.co%2Ff6eb1eb14%26relation%3Dparent.parent&display=hidden&e2e={}&locale=en_US&next=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter%2FdgdTycPTSRj.js%3Fversion%3D41%23cb%3Df229ffc204%26domain%3Drun.plnkr.co%26origin%3Dhttp%3A%2F%2Frun.plnkr.co%2Ff6eb1eb14%26relation%3Dparent%26frame%3Df523faf0c&sdk=joeyâ
Hey there!
Out of curiosity, why would you want to logout your user from facebook?
If I were the user I wouldnât expect that behaviour of a logout action in an application.
Maybe you should think of separating application logout (session disposal) vs facebook logout (which leads to the user being logged out of facebook).
Or perhaps I didnât understand well the issue.
In the scenario where one device use by several people. like ipad, ipad mini, tablet, etc.
hmmm⌠good idea of âseparating application logout (session disposal) vs facebook logoutâ. Probably useful in the future. However, if I logout from session, in order for the user to âswitch to another facebook userâ. it still have problem in of âfacebook cookies retaining in inappbrowserâ and for mobile device not like desktop there is no âswitch user in login menuâ.
If there is a way to have switch user in login menu when popping up facebook. it might be a good enough solution to solve it
Hey all,
Has anyone been able to successfully get the phonegap-facebook-plugin working with ionic? I even tried @accurso_alanâs github project âCostSplitterâ working to no avail. Seems as though the plugin is currently broken so I used release 0.4.2. Iâm just not able to really understand the process since the documentation is pretty bad and thereâs so much conflicting information. Iâm going insane trying to figure it out.
Same problem.
Has anyone been able to successfully get the phonegap-facebook-plugin working with ionic?
I actually did eventually got it working. The current master works pretty well, and their documentation has improved. Basically add the plugin after adding your platforms (iOS/Android). You need to open the Android project and set the facebookLib as a library. You might have to add the facebook app ID in the iOS plist manually (I forget).
Then you need to wrap the facebookConnectPlugin.js in an angular module and include it in your index.html.
Then I basically hacked it in with the followingâŚ
.controller('MyCtrl', function ($window, $scope, $state, FacebookConnectPlugin) {
if(!$window.cordova) {
//Implement in browser... Still kinda broken since it uses cookies to store access token
FacebookConnectPlugin.browserInit('MY_APP_ID');
//in the browser facebookConnectPlugin GLOBAL won't be set. So use our angular module. Probably a better way to do this.
$window.facebookConnectPlugin = FacebookConnectPlugin;
}
facebookConnectPlugin.login( ["email","user_friends"],
function (response) {
//Actually useless. Do whatever you want with the access token
$window.localStorage['fbtoken'] = response.authResponse.accessToken;
//Get user profile
facebookConnectPlugin.api('me',[],
function(fbuser){
//Get user picture
facebookConnectPlugin.api('me/picture?redirect=false&type=large',[],
function(result){
fbuser.img = result.data.url;
//Do stuff with fbuser
},
function(error){
alert('Something bad happened. Please try again later. '+error);
});
},
function(error){
alert('Something bad happened. Please try again later. '+error);
});
},
function (error) {
alert('Something bad happened. Please try again later. '+error);
});
Then build and spend the next 2 hours fixing errors.
Let me know if you run into anything. I know this is really frustrating. Iâve been thinking about publishing an example app on github but my time is limited.
Has anyone else tried the Social Sharing Cordova plugin? I havenât had any luck yet - the build process isnât adding the JSâconfigure and build.xml donât get changed when I do cordova prepare. Looks like itâd fit all my needs. If it workedâŚ
If youâre still willing to share your implementation Iâd love to see it. Have given up implementing the phonegap-facebook plugin multiple times but the recent improvements in documentation have me hopeful.
I ended up using the fantasic ngCordova plugin. They drifty guys wrapped a bunch cordova plugins with angular wrappers, which makes them really easy to use. Let me know if you need anymore info!
Agree with using ngCordova - It was much easier to get working than the Cordova Plugs in Telerik Appbuilder
Yeap. Have it working on my ionic app.