title: Passing custom parameters to Phonegap plugin
body: <p>I have written a Phonegap plugin in order to integrate my Phonegap application with a native SDK library. In order to pass some device registration information to the native library I have used an Objective-C category to plug my own handler after didFinishLaunchingWithOptions, pretty much the same way the <a href="https://github.com/phonegap-build/PushPlugin" rel="nofollow">Phonegap Push Plugin</a> does. I therefore have something like the following:</p>
  
  <pre><code>@implementation AppDelegate (MyLib)
  
  // Using method swizzling to plug our own init method  which allows us to
  // add our own listener for the didFinishLaunching event without overwriting
  // the one already defined by Phonegap.
  + (void)load
  {
      Method original, swizzled;
  
      original = class_getInstanceMethod(self, @selector(init));
      swizzled = class_getInstanceMethod(self, @selector(swizzled_init));
      method_exchangeImplementations(original, swizzled);
  }
  
  - (AppDelegate *)swizzled_init
  {
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(launchHandler:)
                                                   name:@"UIApplicationDidFinishLaunchingNotification" object:nil];
  
      // This actually calls the original init method over in AppDelegate.
      return [self swizzled_init];
  }
  
  // This code will be called immediately after application:didFinishLaunchingWithOptions:.
  - (void)launchHandler:(NSNotification *)notification
  {
      NSString* apiKey = @"xxxxx";
      // Do some initialisation and register the device using the apiKey
  }
  
  @end
  </code></pre>
  
  <p>The apiKey is specific to my application and right now it is defined in AppDelegate+MyLib.m as shown in the code above. My question is, is there a way to allow my Phonegap app to customise this when importing the plugin? Could it be defined in my app's config.xml (or in any other place if that makes a difference) and somehow passed to the plugin's AppDelegate as a parameter?</p>