cordovafacebook-javascript-sdkphonegap-pluginsfbconnectphonegap-build

Facebook Connect plugin using Phonegap Build


I've seen lots of questions about the Facebook Connect plugin using Phonegap only or Phonegap and Phonegap Build, but I still can't seem to make it work.

I created my facebook app (actually all I did was clik the "Create New App" button). I specified the Display Name and Namespace and got an app ID. I updated the code from https://github.com/amirudin/pgb-fbconnect (which is the simple example for the Facebook Connect plugin) with my app ID and Namespace in both index.html and config.xml. I zipped it to Phonegap Build (no Phonegap version is specified in config.xml so it defaults to 2.9).

On Android (2.3.6 and 4.1) I always get Cordova Facebook Connect plugin fail on init! On iOS nothing is displayed but nothing works either.

As this alert is only shown when calling FB._nativeInterface.init, I tried using nativeInterface : false instead of nativeInterface : CDV.FB in FB.init. In that case if I try to login, the login page is displayed but after entering my name and password I get Given URL is not permitted by the application configuration.: One or more of the given URLs is not allowed by the App's settings....

I'm not sure how to configure the facebook app:

Event after that I still get the same Given URL is not permitted by the application configuration... error. I know Phonegap uses file:// and not http://localhost but then I just don't know how to configure the facebook app.

I'm not sure if the Cordova Facebook Connect plugin fail on init! error is linked or not with the App Domain issue or if it's two unrelated issues that I'll have to solve.


Solution

  • Trying my app on another Android phone the next day, I noticed I had no more error. I removed and reinstalled the app on the other Android phones and the plugin also started working fine on all of them.

    I'm not sure what the problem might have been: issue with hydra plugin (now I know if something weird happens I may have to remove and reinstall the app, and make sure the hydration is complete), needed more time after creating the app on facebook (even if it's stated it can take minutes, and not hours, to update all the servers), ...