I'm trying to implement Phonegap Facebook Connect plugin via PhoneGap build and FB.getLoginStatus ALWAYS returns "unknown" even though I'm logged into Facebook and have granted access to my app. Here's my code:
JAVASCRIPT CODE:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady()
{
FB.init
({
appId: 'XXXXX',
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: false, // parse XFBML
oauth : true ,// enable OAuth 2.0
useCachedDialogs: false,
nativeInterface : CDV.FB
});
FB.getLoginStatus(function (response)
{
alert('FB.getLoginStatus');
if (response.status === 'connected')
{
alert('DUDE: connected to facebook');
}
else if (response.status === 'not_authorized')
{
alert('DUDE: not authorized for facebook');
}
else
{
alert('DUDE: not logged in to facebook: ' + response.status);
}
}, true);
}
CONFIG.XML:
<gap:plugin name="com.phonegap.plugins.facebookconnect">
<param name="APP_ID" value="XXXXXXX" />
<param name="APP_NAME" value="APP NAME" />
</gap:plugin>
Any ideas on why facebook auth status is unknown? Thanks.