4 Replies Latest reply on Aug 5, 2016 7:31 AM by VectorP

    admob in phonegap build

    idob52544348

      Hello,

       

      I am trying to implement ads in my app.

      I saw in some guidelines that I need to add <gap:plugin name="cordova-admob" source="npm"/> to my config.xml file

      (00. How To Use with PhoneGap Build · floatinghotpot/cordova-admob-pro Wiki · GitHub )

      For some reason the zip file fails once I add this plugin.

       

      this is how my XML looks like :

       

       

      <widget id="XXX.YYY.ZZZ" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

        <name>XXX</name>

        <description>

        </description>

       

        <content src="index.html" />

        <plugin name="cordova-plugin-whitelist" spec="1" />

       

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

       

        <access origin="*" />

        <allow-navigation href="*" />

        <allow-intent href="http://*/*" />

        <allow-intent href="https://*/*" />

        <allow-intent href="tel:*" />

        <allow-intent href="sms:*" />

        <allow-intent href="mailto:*" />

        <allow-intent href="geo:*" />

        <platform name="android">

            <allow-intent href="market:*" />

              <!--

                  ldpi    : 36x36 px

                  mdpi    : 48x48 px

                  hdpi    : 72x72 px

                  xhdpi   : 96x96 px

                  xxhdpi  : 144x144 px

                  xxxhdpi : 192x192 px

              -->

        <icon src="res/android/mdpi.png" density="mdpi" />

        <icon src="res/android/hdpi.png" density="hdpi" />

        <icon src="res/android/xhdpi.png" density="xhdpi" />

        <icon src="res/android/xxhdpi.png" density="xxhdpi" />

        <icon src="res/android/xxxhdpi.png" density="xxxhdpi" />

        </platform>

        <platform name="ios">

            <allow-intent href="itms:*" />

            <allow-intent href="itms-apps:*" />

        </platform>

      </widget>

       

       

      Can you please advice what am I doing wrong?

      Why does the build fails with this config.xml?

      What is the best way to add admob plugin?

       

      Thanks,

      Ido

        • 1. Re: admob in phonegap build
          ryanskihead Adobe Employee

          Have another look at the document you've referenced. The required plugin declaration is:

           

          <preference name="android-build-tool" value="gradle" />

          <gap:plugin name="cordova-plugin-admobpro" source="npm" />

          • 2. Re: admob in phonegap build
            idob52544348 Level 1

            Hi, also after I used these two line, the build didn't pass and I got an error.

            This is what I found in the logs:

             

            Build Date: 2016-08-05 05:31:12 +0000 -------------------------------------------------------------------------------- PLUGIN OUTPUT -------------------------------------------------------------------------------- Fetching plugin "cordova-plugin-admobpro" via npm Installing "cordova-plugin-admobpro" at "2.19.1" for android Fetching plugin "cordova-plugin-extension" via npm Installing "cordova-plugin-extension" at "1.5.1" for android Fetching plugin "cordova-plugin-whitelist@1" via npm Installing "cordova-plugin-whitelist" at "1.2.2" for android                 This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.


            Any Ideas?
            Thanks,
            Ido
            PLUGIN OUTPUT -------------------------------------------------------------------------------- Fetching plugin "cordova-plugin-admobpro" via npm Installing "cordova-plugin-admobpro" at "2.19.1" for android Fetching plugin "cordova-plugin-extension" via npm Installing "cordova-plugin-extension" at "1.5.1" for android Fetching plugin "cordova-plugin-whitelist@1" via npm Installing "cordova-plugin-whitelist" at "1.2.2" for android                 This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
            • 3. Re: admob in phonegap build
              oscard69101911

              Hi.

              I have admob working with phonegap build:

               

              In my config I have:

               

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

               

              I don't have anything related with gradle.

               

              I followed the instructions of this page:

               

              GitHub - appfeel/admob-google-cordova: AdMob ads Cordova/Phonegap/Intel XDK plugin for Android iPhone with latest SDK's

               

              Regards.

              • 4. Re: admob in phonegap build
                VectorP Level 4

                You have no namespace :gap declared in your widget element. Only the :cdv namespace, which is not sufficient.

                As a result, your xml is not valid.

                 

                Alternatively, you could use the plugin element's syntax without the :gap namespace.