PhoneGap add Facebook Connect plugin

后端 未结 2 1544
轮回少年
轮回少年 2021-01-15 03:07

I want to add com.phonegap.plugins.facebookconnect to my PhoneGap build android app but I unable to do it. In doc site they say to add



        
2条回答
  •  花落未央
    2021-01-15 04:03

    @Dom I did step by step how you specified: 1. added to config.xml in platforms/android/assets/www/config.xml 2. included js files in header and when I execute phonegap install android from cmd with this code:

    document.addEventListener('deviceready', function() {
    alert('1');
      FB.init({
          appId: 'appid',
          nativeInterface: CDV.FB,
          useCachedDialogs: false
      });
      alert('2');
    
      FB.getLoginStatus(handleStatusChange);
      alert('3');
    
      authUser();
      updateAuthElements();
      alert('4');
    });
    

    it only displays first alert and removes .js files from heder. Why is that happening? - It was happening because when you edit in phonegap build you don't edit in platforms/adnroid/assets/www but in root folder of project there is www folder and you edit config.xml and index.html there and after running app it is build for android from there.

    Edit: I have just wrapped FB.init in try/catch and I got this error : ReferenceError FB is not defined I think that is because js is not loading.

提交回复
热议问题