title: Create a Custom AdMob Plugin for Phonegap Build (for iOS and Android)
body: <p>Everything in my Phonegap Build app is working, including the Analytics and FacebookConnect plugins. However, now I would like to add AdMob ads.</p>
  
  <p>Phonegap Build does not provide a built-in plugin for AdMob, but according to the <a href="https://build.phonegap.com/docs/plugins" rel="nofollow noreferrer">Phonegap Build Plugins page</a>, you can now add your own custom plugins (see Contributing Plugins at the bottom of the page).</p>
  
  <blockquote>
    <p>PhoneGap Plugins can be made compatible with PhoneGap Build with the
    use of a plugin.xml file...</p>
  </blockquote>
  
  <p>The Phonegap Build Plugins page references the <a href="https://github.com/alunny/ChildBrowser/blob/master/plugin.xml" rel="nofollow noreferrer">Child Browser plugins.xml on GitHub</a> as an example of how to setup the custom plugin.xml. Below is the content of the Child Browser plugin.xml.</p>
  
  <p><strong>I'm not sure what aspects of this file I need to modify and what to modify them to. I think I have correctly setup the file structure of the Phonegap AdMob Plugins for both <a href="https://github.com/rajpara11/phonegap-plugins/tree/master/iOS/AdMobPlugin" rel="nofollow noreferrer">iOS</a> and <a href="https://github.com/rajpara11/phonegap-plugins/tree/master/Android/AdMobPlugin" rel="nofollow noreferrer">Android</a> (see the file structure below), but I'm not sure how to reference these files correctly in the plugin.xml file.</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
      xmlns:android="http://schemas.android.com/apk/res/android"
      id="com.phonegap.plugins.childbrowser"
      version="3.0.4"&gt;
  
      &lt;name&gt;Child Browser&lt;/name&gt;
  
      &lt;asset src="www/childbrowser.js" target="childbrowser.js" /&gt;
      &lt;asset src="www/childbrowser" target="childbrowser" /&gt;
  
      &lt;!-- android --&gt;
      &lt;platform name="android"&gt;
          &lt;config-file target="AndroidManifest.xml" parent="/manifest/application"&gt;
              &lt;activity android:name="com.phonegap.plugins.childBrowser.ChildBrowser"
                        android:label="@string/app_name"&gt;
                  &lt;intent-filter&gt;
                  &lt;/intent-filter&gt;
              &lt;/activity&gt;
          &lt;/config-file&gt;
  
          &lt;!-- Cordova 1.5 - 1.9 --&gt;
          &lt;config-file target="res/xml/plugins.xml" parent="/plugins"&gt;
              &lt;plugin name="ChildBrowser"
                  value="com.phonegap.plugins.childBrowser.ChildBrowser"/&gt;
          &lt;/config-file&gt;
  
          &lt;!-- Cordova 2.0.0 --&gt;
          &lt;config-file target="res/xml/config.xml" parent="/cordova/plugins"&gt;
              &lt;plugin name="ChildBrowser"
                  value="com.phonegap.plugins.childBrowser.ChildBrowser"/&gt;
          &lt;/config-file&gt;
  
          &lt;source-file src="src/android/ChildBrowser.java"
                  target-dir="src/com/phonegap/plugins/childBrowser" /&gt;
      &lt;/platform&gt;
      &lt;!-- ios --&gt;
      &lt;platform name="ios"&gt;
          &lt;plugins-plist key="ChildBrowser"
                      string="ChildBrowserCommand" /&gt;
  
          &lt;resource-file src="ChildBrowser.bundle" /&gt;
          &lt;resource-file src="ChildBrowserViewController.xib" /&gt;
  
          &lt;header-file src="ChildBrowserCommand.h" /&gt;
          &lt;header-file src="ChildBrowserViewController.h" /&gt;
  
          &lt;source-file src="ChildBrowserCommand.m" /&gt;
          &lt;source-file src="ChildBrowserViewController.m" /&gt;
      &lt;/platform&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p><strong>App File Structure</strong></p>
  
  <pre><code>/index.html 
  /config.xml 
    /adMob 
      /plugin.xml 
      /src
        /iOS 
          /GADAdMobExtras.h (from AdMob iOS SDK)
          /GADAdNetworkExtras.h (from AdMob iOS SDK)
          /GADAdSize.h (from AdMob iOS SDK)
          /GADBannerView.h (from AdMob iOS SDK)
          /GADBannerViewDelegate.h (from AdMob iOS SDK)
          /GADInterstitial.h (from AdMob iOS SDK)
          /GADInterstitialDelegate.h (from AdMob iOS SDK)
          /GADRequest.h (from AdMob iOS SDK)
          /GADRequestError.h (from AdMob iOS SDK)
          /libGoogleAdMobAds.a (from AdMob iOS SDK)
          /AdMobPlugin.h (from Phonegap Plugin for iOS)
          /AdMobPlugin.js (from Phonegap Plugin for iOS)
          /AdMobPlugin.m (from Phonegap Plugin for iOS)
        /android
          /AdMobPlugin.java (from Phonegap Plugin for Android)
          /AdMobPlugin.js (from Phonegap Plugin for Android)
          /GoogleAdMobAdsSdk-6.2.1.jar (from AdMob Android SDK)
  </code></pre>
  
  <p><a href="https://github.com/rajpara11/phonegap-plugins/tree/master/iOS/AdMobPlugin" rel="nofollow noreferrer">Phonegap Plugin for iOS</a><br />
  <a href="https://developers.google.com/mobile-ads-sdk/download#downloadios" rel="nofollow noreferrer">AdMob iOS SDK</a><br />
  <a href="https://github.com/rajpara11/phonegap-plugins/tree/master/Android/AdMobPlugin" rel="nofollow noreferrer">Phonegap Plugin for Android</a><br />
  <a href="https://developers.google.com/mobile-ads-sdk/download#downloadandroid" rel="nofollow noreferrer">AdMob Android SDK</a><br /></p>