问题
I'm using this plugin to have a facebook-login option in my Phonegap app: https://github.com/phonegap/phonegap-facebook-plugin.
I've followed all the steps in the Android 'getting started' and everything works fine when I run the app on a device (emulator and real) that doesn't have the official Facebook app installed. When I run it on a device which has the official Facebook app installed and I click on the login button, the Facebook dialogue appears and it asks for permission. I choose OK, the dialogue disappears and nothing happens. No error or other alert appears and I'm not logged in neither.
How can I fix this?
The javascript:
function logout() {
FB.logout(function(response) {
alert('logged out');
});
}
function logIn() {
try {
FB.init({ appId: "*****************", nativeInterface: CDV.FB, useCachedDialogs: false });
} catch (e)
{
alert("error");
}
FB.login(
function(response) {
if (response.authResponse) {
// not invoked
alert('logged in');
} else {
// not invoked
alert('error');
}
},
{ scope: "email" }
);
}
回答1:
Thanks for giving me the hint that it has something to do with the FB app setttings: in my case, the reason for this problem (phonegap-facebook-plugin: only works when native FB app is not installed (Android)) was, that I did not release-sign the Android app, that was using the phonegap-facebook-plugin.
After I signed my Android App in release mode (with the keystore that was used to generate the key hash), the app worked even with the FB App installed.
A side note: thank you to all the contributors on stackoverflow!! Without those tips & tricks & hints like this one, I would never be able to do my work.
来源:https://stackoverflow.com/questions/15522372/phonegap-facebook-plugin-only-works-when-native-fb-app-is-not-installed-androi