问题
I added a in the file config.xml:
<preference name="android-minSdkVersion" value="17"/>
...
<preference name="phonegap-version" value="cli-6.5.0" />
...
<plugin name="cordova-plugin-facebook4" spec="1.7.4" source="npm">
<param name="APP_ID" value="XXXXXXXXXXXXXXX" />
<param name="APP_NAME" value="MyProg" />
</plugin>
The application is already registered in facebook and it was indicated above instead of X...
Please give an example of using the plugin - cordova-plugin-facebook4 for PhoneGap project. I did not find a suitable example from this resource - https://www.npmjs.com/package/cordova-plugin-facebook4
回答1:
I tried this:
$(document).on("click", "#snid", function(){
facebookConnectPlugin.getLoginStatus(function(response) {
if (response.status === "connected") {
alert("Logged in, details:\n\n" + JSON.stringify(response.authResponse));
} else {
alert("Not logged in");
}
});
var fbLoginSuccess = function (userData) {
alert("UserInfo: ", userData);
};
facebookConnectPlugin.login(["public_profile"], fbLoginSuccess,
function loginError (error) {
alert(error)
}
);
});
Show message: Not logged in
Then it hangs: Screenshot
来源:https://stackoverflow.com/questions/44719617/need-example-cordova-plugin-facebook4-for-phonegap-project