title: Phonegap android - window.plugins undefined
body: <p>I have created my own Plugin, which calls a class written in java. I want to call this plugin from Javascript code. The error comes in the code:</p>
  
  <pre><code>window.plugins.locationListing.list("/sdcard",
          function(r){gotLocation(r)},
          function(e){onError(e)}
  );
  </code></pre>
  
  <p>window.plugins is undefined.</p>
  
  <p>Following are the things I have done:<br/>
  1) Created a LocationFinder plugin class in my source folder<br/>
  2) Added the plugin to res/xml/plugins.xml</p>
  
  <pre><code>&lt;plugin name="LocationFinder" value="com.phonegap.plugins.locationListing.LocationFinder"/&gt;
  </code></pre>
  
  <p>3) Created a javascript file called locationlisting.js:</p>
  
  <pre><code>var LocationListing = function() {
  };
  
  LocationListing.prototype.list = function(directory, successCallback, failureCallback) {
    return PhoneGap.exec(successCallback,    
        failureCallback,
        'LocationFinder',
        'list',
        directory);
  };
  </code></pre>
  
  <p>4) In my main.html added locationlisting.js, main.js, phonegap-1.0.0.js.<br/>
  5) From my main.js, I call the plugin, that is where I execute the first piece of code I wrote above, copied below:</p>
  
  <pre><code>function callPlugin() {
      window.plugins.locationListing.list("/sdcard",
          function(r){gotLocation(r)},
          function(e){onError(e)}
      );
  }
  </code></pre>
  
  <p>This is where window.plugins is undefined. What could be the problem? I have all my js files stored in www/. Any help would be appreciated.</p>