Create your own AdMob plugin to build Phonegap (for iOS and Android)

Everything in my Phonegap Build app works, including the Google Analytics and FacebookConnect plugins. However, now I would like to add AdMob ads.

Phonegap Build does not provide a built-in plugin for AdMob, but according to the plugins page for building Phonegap, you can now add your own custom plugins (see the "Plugins for Contributing" section at the bottom of the page).

PhoneGap plugins can be made compatible with PhoneGap Build by using the plugin.xml file ...

The Phonegap build plugins page links to Child Browser plugins.xml on GitHub as an example of how to configure a custom plugin.xml file. The following is the contents of the Child Browser plugin.xml module.

I'm not sure which aspects of this file I need to change and what to change them. I think I have correctly configured the file structure of the Admob plugins for Phonegap for iOS and Android (see the file structure below), but I'm not sure how to refer to these files in the plugin.xml file correctly.

<?xml version="1.0" encoding="UTF-8"?> <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"> <name>Child Browser</name> <asset src="www/childbrowser.js" target="childbrowser.js" /> <asset src="www/childbrowser" target="childbrowser" /> <!-- android --> <platform name="android"> <config-file target="AndroidManifest.xml" parent="/manifest/application"> <activity android:name="com.phonegap.plugins.childBrowser.ChildBrowser" android:label="@string/app_name"> <intent-filter> </intent-filter> </activity> </config-file> <!-- Cordova 1.5 - 1.9 --> <config-file target="res/xml/plugins.xml" parent="/plugins"> <plugin name="ChildBrowser" value="com.phonegap.plugins.childBrowser.ChildBrowser"/> </config-file> <!-- Cordova 2.0.0 --> <config-file target="res/xml/config.xml" parent="/cordova/plugins"> <plugin name="ChildBrowser" value="com.phonegap.plugins.childBrowser.ChildBrowser"/> </config-file> <source-file src="src/android/ChildBrowser.java" target-dir="src/com/phonegap/plugins/childBrowser" /> </platform> <!-- ios --> <platform name="ios"> <plugins-plist key="ChildBrowser" string="ChildBrowserCommand" /> <resource-file src="ChildBrowser.bundle" /> <resource-file src="ChildBrowserViewController.xib" /> <header-file src="ChildBrowserCommand.h" /> <header-file src="ChildBrowserViewController.h" /> <source-file src="ChildBrowserCommand.m" /> <source-file src="ChildBrowserViewController.m" /> </platform> </plugin> 

Application file structure

 /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) 

Phone plugin for iOS
AdMob iOS SDK
Android Phone Plugin
AdMob Android SDK

+46
cordova admob phonegap-build phonegap-plugins
Feb 12 '13 at 23:15
source share
5 answers

This is an old unanswered question, since from today it has been impossible. But Phonegap announced a change in its rules: see here , so now you can use external plugins. To add Admob advertisements to your Phonegap Build application, edit the config.html file and place the following code:

 <gap:plugin name="phonegap-admob" source="npm" /> 

I am the author of the plugin and you can see the live demo application (Android only) here

+3
Dec 11 '14 at 14:01
source share

I am doing plugin

But PhoneGap Build was denied because it contains Google binaries ...
Today you have no decision to use Admob in the PhoneGap Build project.

+2
Oct 18 '13 at 9:46
source share

For admob: its a bit confusing to read about them, because in the past they used ads using the JavaScript method for the mobile website, but after Google bought the company, they deleted it and admob no longer serves the mobile website and for a mobile website, they advise you to use adsense. What is confusing is that there is also an instruction for installing admob JavaScript, which no longer exists.
I saw your links, and I assume that you are trying to install admob for an iOS application. I did it for an Android app that was straightforward, and it was easy , but the problem is that ever I try to show it below.

0
Jun 06 '13 at 16:09
source share

PhoneGap Build now allows any user to make a plugin that will be available to all users (after viewing and testing the course).
They have a new page describing the process and tips seeking to contribute to take a look at the Facebook plugin repo.

So, perhaps you can create a good Admob plugin based on this documentation .

0
Jul 18 '13 at 19:26
source share

This article has everything you are looking to configure a plugin for your plugin.

0
Nov 06 '13 at 20:55
source share



All Articles