Need example cordova-plugin-facebook4 for PhoneGap project

混江龙づ霸主 提交于 2019-12-25 09:35:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!