phonegap/phonegap-facebook-plugin — pull request #429 by dario-simonetti (2014-04-02 11:58:09+00:00)
Title: Fixes to make the plugin automatic installation work on Android

I tried to automatically install the plugin using what is specified in README:

```
cordova -d plugin add /Users/your/path/here/phonegap-facebook-plugin --variable APP_ID="1*************4" --variable APP_NAME="myApplication"
```

The simple JavaScript I tried to run to initialize the JavaScript SDK is:
``` javascript
try {
FB.init({
appId : "1*************4",
nativeInterface : CDV.FB,
useCachedDialogs : false
});
} catch (e) {
alert(e);
}
```

This alerts:
> Cordova Facebook Connect plugin fail on init!

Having a look in the logs, I could see the following debug message:

> PluginManager: exec() call to unknown plugin: org.apache.cordova.facebook.Connect

To fix that problem, I had to manually change the feature in `platforms/android/res/xml/config.xml` from:

```xml

```

to

```xml

```

After this change, it still fails on init but the debug message in the logs is not there anymore, so the plugin is initialised successfully.

Having a look at the file in `platforms/android/assets/www/cdv-plugin-fb-connect.js` on line 16 you can see:

```javascript
cordova.exec(function() {
// (...)
}, (fail?fail:null), 'org.apache.cordova.facebook.Connect', 'init', [apiKey]);
```

This calls `ConnectPlugin`'s `execute` method, passing "init" as first parameter (action). The action "init" is not handled in the method so it returns false, which throws a `MethodNotFound` exception. Adding this simple snippet solves the problem:

```java
if (action.equals("init")) {
return true;
} else // (...)
```

Making these two changes makes the plugin automatic installation work on Android and the Facebook JavaScript SDK works perfectly.

Using Cordova 3.3.0 (no luck with 3.4.0 either)