-
-
Save Angelfirenze/8834867 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="YOUR_FB_APP_ID" --variable APP_NAME="YOUR_APP_NAME" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
if (typeof CDV == 'undefined') alert('CDV variable does not exist. Check that you have included cdv-plugin-fb-connect.js correctly'); | |
if (typeof FB == 'undefined') alert('FB variable does not exist. Check that you have included the Facebook JS SDK file.'); | |
document.addEventListener('deviceready', function() { | |
try { | |
FB.init({ | |
appId: "YOUR_FB_APP_ID", | |
nativeInterface: CDV.FB, | |
useCachedDialogs: false | |
}); | |
document.getElementById('data').innerHTML = ""; | |
} catch (e) { | |
alert(e); | |
} | |
}, false); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loginButton = $('#login-with-facebook'); | |
loginButton.on('click', function(e) { | |
e.preventDefault(); | |
FB.login(function(response) { | |
if (response.status === 'connected') { | |
alert('logged in'); | |
} else { | |
alert('not logged in'); | |
} | |
},{ scope: "email" }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment