AdMob

53 posts, 0 answers
  1. Ned
    Ned avatar
    32 posts
    Member since:
    Jul 2013

    Posted 17 Oct 2013 Link to this post

    I can get this plugin for Cordova 3.0

    https://github.com/floatinghotpot/cordova-plugin-admob

    to build. And I even got it to work once! But I messed up something in the plugin.xml and can't find my way back. I've tried all of the docs, but window.plugins.AdMob is always undefined. Any help is greatly appreciated -- I've been at this for days and am about to give up since it builds and installs cleanly with cordova-cli. 
  2. Ned
    Ned avatar
    32 posts
    Member since:
    Jul 2013

    Posted 17 Oct 2013 Link to this post

    Ok, it never works after a rebuild in Icenium. I have to totally uninstall and re-install the app. Then the plugin works. I've seen a lot of forum posts about plugins not working. Maybe this is related.
  3. Bob
    Bob avatar
    1 posts
    Member since:
    Mar 2011

    Posted 19 Oct 2013 Link to this post

    Please could somebody post a working example of how to integrate Google AdMob into an Icenium Kendo Mobile project for Android. I am using Icenium 1.8.
    regards,
    Bob Pemberton
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 23 Oct 2013 Link to this post

    Hi Bob,

    The AdMob Cordova plugin is plugman compatible and modified to support Cordova 3.0, so you can download it as a zip from the github repo that Ned posted and add it to your Icenium project as described in our documentation:
    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  5. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 23 Oct 2013 Link to this post

    I don't want to side-track this thread, but if someone has an idea how to show AdMob ads only on certain pages and not through the whole app, I would love to hear from you.
  6. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 24 Oct 2013 Link to this post

    Not sure how to get this to work. The documentation Steve links to in his first post, under 'Add includes for the custom plugin in Icenium Graphite or Mist' says to locate definitions for the <asset> element. The admob from the github repo doesn't have such an element in its plugin.xml

    however, I found a '<js-module src="www/AdMob.js" name="AdMob">'. Should I use that one and modify it to '= <asset src="www/AdMob.js" name="AdMob">'?
  7. Ned
    Ned avatar
    32 posts
    Member since:
    Jul 2013

    Posted 24 Oct 2013 Link to this post

    The plugin now supports a destroyBannerView call. So, you can destroy on pages you don't want etc. I have it in my pageshow event and destroy / create on each pageshow.
  8. Ned
    Ned avatar
    32 posts
    Member since:
    Jul 2013

    Posted 24 Oct 2013 Link to this post

    Got it working. The plugin now has a destroyBannerView method as well.
  9. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 24 Oct 2013 Link to this post

    Thank you, I will look into that, I actually just found that in the code :)

    However, I don't get it to work. In the simulator I get a: Uncaught ReferenceError: require is not defined and when building for Android device I get 'package com.google.ads does not exist'.

    should I import more than just this plugin? Looks like I am missing the ads package?
  10. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 24 Oct 2013 Link to this post

    Thank you, I will look into that, I actually just found that in the code :)

    However, I don't get it to work. In the simulator I get a: Uncaught ReferenceError: require is not defined and when building for Android device I get 34 errors.

    should I import more than just this plugin? Looks like I am missing a something?
  11. Ned
    Ned avatar
    32 posts
    Member since:
    Jul 2013

    Posted 24 Oct 2013 Link to this post

    No need to do that.

    1. Clone the plugin down (or add locally with cordova-cli). Zip up the plugin folder and extract to Plugins.
    2. Put the IOS sdk files in the src/ios folder.
    3. Put the Android sdk jar file in src/android folder
    4. Modify plugin.xml and add ...

    <source-file src="src/android/GoogleAdMobAdsSdk-6.4.1.jar" target-dir="libs" />

    right above the source file for AdMob.js. The clobber needs to be

    <js-module src="www/AdMob.js" name="plugins.AdMob">
            <clobbers target="plugins.AdMob" />
      </js-module>

    5. You need to add the line 

    <plugin name='AdMob' value='com.google.cordova.plugin.admob'/>

    to plugins.xml in your docroot and in res/xml/plugins.xml.

    6. My javascript looks something like this (I use jquerymobile pageshow event) ...

    // is plugin loaded
        if (window.plugins.AdMob) {

          // vars
          var adIdiOS = 'somepubidios';
          var adIdAndroid = 'somepubidandroid';

          // Might be platform dependant      
          var adId = (navigator.userAgent.indexOf('Android') >=0) ? adIdAndroid : adIdiOS;

          // get new window object
          var am = window.plugins.AdMob;

          // destroy any running adView
          am.destroyBannerView();

          // create new adView
          am.createBannerView(
            {
              'publisherId' : adId,
              'adSize' : am.AD_SIZE.BANNER,
              'bannerAtTop' : false
            },
            function() {
              am.requestAd({
                'isTesting' : true,
                'extras' : {
                  'color_bg' : '000000',
                  'color_bg_top' : '000000',
                  'color_border' : '000000',
                  'color_link' : 'FFFFFF',
                  'color_text' : 'FFFFFF',
                  'color_url' : 'FFFFFF'
                }},
                function() {
                  am.showAd(
                    true,
                    function() {},
                    function() {
                      console.log('Error showing Ad');
                    }
                  );
                },
                function() {
                  console.log('Error requesting Ad');
                }
              );
            },
            function() {
              console.log('Error create Ad Banner');
            }
          );
        } else {
          console.log('AdMob plugin not loaded.');
        }

    7. Note the ad size is BANNER -- I could not get SMART_BANNER to work.

    8. I would test with "house ads" because the testing flag seems to only work in the Android emulator which is pretty slow and worthless IMO. You will get revenue for impressions if testing is set to true if you are running on actual device!

    Hope that helps.





  12. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 24 Oct 2013 Link to this post

    Hi guys,

    @Ned: thank you for the feedback!

    @JD: js-module is the new way to add js references in plugin.xml, the bonus is that you no longer need to add <script> reference to the .js file in your html pages. <asset> would still be used for other kind of resources.
    About the plugin - remember that Cordova plugins are not supported in Simulator and ION. You should deploy on actual device.

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  13. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 24 Oct 2013 Link to this post

    Thank you Ned, I am going to play with that!
  14. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 24 Oct 2013 Link to this post

    Steve,

    It seems not as easy as I understand from your post. I downloaded the zip archive from the first post of this thread and imported it in my project.

    When I build for device I get 34 errors (I wanted to attach a document, but attaching files seems to be broken, please try yourself):

    -pre-compile:
     
    -compile:
        [javac] Compiling 42 source files to /tmp/b599ad68d1bc489094e7dc0e7428956d/bin/classes
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:3: package com.google.ads does not exist
        [javac] import com.google.ads.Ad;
        [javac]                      ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:4: package com.google.ads does not exist
        [javac] import com.google.ads.AdListener;
        [javac]                      ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:5: package com.google.ads does not exist
        [javac] import com.google.ads.AdRequest;
        [javac]                      ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:6: package com.google.ads.AdRequest does not exist
        [javac] import com.google.ads.AdRequest.ErrorCode;
        [javac]                                ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:7: package com.google.ads does not exist
        [javac] import com.google.ads.AdSize;
        [javac]                      ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:8: package com.google.ads does not exist
        [javac] import com.google.ads.AdView;
        [javac]                      ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:9: package com.google.ads.mediation.admob does not exist
        [javac] import com.google.ads.mediation.admob.AdMobAdapterExtras;
        [javac]                                      ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:32: cannot find symbol
        [javac] symbol  : class AdView
        [javac] location: class org.apache.cordova.plugin.AdMob
        [javac]   private AdView adView;
        [javac]           ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:394: cannot find symbol
        [javac] symbol  : class AdSize
        [javac] location: class org.apache.cordova.plugin.AdMob
        [javac]   public static AdSize adSizeFromSize(String size) {
        [javac]                 ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:211: cannot find symbol
        [javac] symbol  : class AdSize
        [javac] location: class org.apache.cordova.plugin.AdMob.CreateBannerViewRunnable
        [javac]     private AdSize adSize;
        [javac]             ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:213: cannot find symbol
        [javac] symbol  : class AdSize
        [javac] location: class org.apache.cordova.plugin.AdMob.CreateBannerViewRunnable
        [javac]     public CreateBannerViewRunnable(String publisherId, AdSize adSize) {
        [javac]                                                         ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:350: cannot find symbol
        [javac] symbol  : class AdListener
        [javac] location: class org.apache.cordova.plugin.AdMob
        [javac]   private class BannerListener implements AdListener {
        [javac]                                           ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:352: cannot find symbol
        [javac] symbol  : class Ad
        [javac] location: class org.apache.cordova.plugin.AdMob.BannerListener
        [javac]     public void onReceiveAd(Ad ad) {
        [javac]                             ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:357: cannot find symbol
        [javac] symbol  : class Ad
        [javac] location: class org.apache.cordova.plugin.AdMob.BannerListener
        [javac]     public void onFailedToReceiveAd(Ad ad, ErrorCode errorCode) {
        [javac]                                     ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:357: cannot find symbol
        [javac] symbol  : class ErrorCode
        [javac] location: class org.apache.cordova.plugin.AdMob.BannerListener
        [javac]     public void onFailedToReceiveAd(Ad ad, ErrorCode errorCode) {
        [javac]                                            ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:364: cannot find symbol
        [javac] symbol  : class Ad
        [javac] location: class org.apache.cordova.plugin.AdMob.BannerListener
        [javac]     public void onPresentScreen(Ad ad) {
        [javac]                                 ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:369: cannot find symbol
        [javac] symbol  : class Ad
        [javac] location: class org.apache.cordova.plugin.AdMob.BannerListener
        [javac]     public void onDismissScreen(Ad ad) {
        [javac]                                 ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:374: cannot find symbol
        [javac] symbol  : class Ad
        [javac] location: class org.apache.cordova.plugin.AdMob.BannerListener
        [javac]     public void onLeaveApplication(Ad ad) {
        [javac]                                    ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:224: cannot find symbol
        [javac] symbol  : class AdView
        [javac] location: class org.apache.cordova.plugin.AdMob.CreateBannerViewRunnable
        [javac]         adView = new AdView(cordova.getActivity(), adSize, publisherId);
        [javac]                      ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:279: cannot find symbol
        [javac] symbol  : class AdRequest
        [javac] location: class org.apache.cordova.plugin.AdMob.RequestAdRunnable
        [javac]         AdRequest request = new AdRequest();
        [javac]         ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:279: cannot find symbol
        [javac] symbol  : class AdRequest
        [javac] location: class org.apache.cordova.plugin.AdMob.RequestAdRunnable
        [javac]         AdRequest request = new AdRequest();
        [javac]                                 ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:285: cannot find symbol
        [javac] symbol  : variable AdRequest
        [javac] location: class org.apache.cordova.plugin.AdMob.RequestAdRunnable
        [javac]           request.addTestDevice(AdRequest.TEST_EMULATOR);
        [javac]                                 ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:287: cannot find symbol
        [javac] symbol  : class AdMobAdapterExtras
        [javac] location: class org.apache.cordova.plugin.AdMob.RequestAdRunnable
        [javac]         AdMobAdapterExtras extras = new AdMobAdapterExtras();
        [javac]         ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:287: cannot find symbol
        [javac] symbol  : class AdMobAdapterExtras
        [javac] location: class org.apache.cordova.plugin.AdMob.RequestAdRunnable
        [javac]         AdMobAdapterExtras extras = new AdMobAdapterExtras();
        [javac]                                         ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:351: method does not override or implement a method from a supertype
        [javac]     @Override
        [javac]     ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:356: method does not override or implement a method from a supertype
        [javac]     @Override
        [javac]     ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:363: method does not override or implement a method from a supertype
        [javac]     @Override
        [javac]     ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:368: method does not override or implement a method from a supertype
        [javac]     @Override
        [javac]     ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:373: method does not override or implement a method from a supertype
        [javac]     @Override
        [javac]     ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:396: cannot find symbol
        [javac] symbol  : variable AdSize
        [javac] location: class org.apache.cordova.plugin.AdMob
        [javac]       return AdSize.BANNER;
        [javac]              ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:398: cannot find symbol
        [javac] symbol  : variable AdSize
        [javac] location: class org.apache.cordova.plugin.AdMob
        [javac]       return AdSize.IAB_MRECT;
        [javac]              ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:400: cannot find symbol
        [javac] symbol  : variable AdSize
        [javac] location: class org.apache.cordova.plugin.AdMob
        [javac]       return AdSize.IAB_BANNER;
        [javac]              ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:402: cannot find symbol
        [javac] symbol  : variable AdSize
        [javac] location: class org.apache.cordova.plugin.AdMob
        [javac]       return AdSize.IAB_LEADERBOARD;
        [javac]              ^
        [javac] /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/plugin/AdMob.java:404: cannot find symbol
        [javac] symbol  : variable AdSize
        [javac] location: class org.apache.cordova.plugin.AdMob
        [javac]       return AdSize.SMART_BANNER;
        [javac]              ^
        [javac] Note: /tmp/b599ad68d1bc489094e7dc0e7428956d/src/org/apache/cordova/core/InAppBrowser.java uses or overrides a deprecated API.
        [javac] Note: Recompile with -Xlint:deprecation for details.
        [javac] 34 errors
     
     
    Done building project "tstAdMob.proj" -- FAILED.

    Either I am missing something or I should follow all steps Ned explained. I have understood that AdMob is plugman compatible.
  15. Ned
    Ned avatar
    32 posts
    Member since:
    Jul 2013

    Posted 25 Oct 2013 Link to this post

    You definitely need the google ads sdk. Nothing will work without it on android.
  16. Ned
    Ned avatar
    32 posts
    Member since:
    Jul 2013

    Posted 28 Oct 2013 Link to this post

    Ok, so the compile on Android is fine as I noted above. But I'm getting some linker errors with the new AdMob SDK for IOS. It seems that the static library 'libCordova.a' which we're linking in the main app is only compiled for one architecture (armv7, but not armv7s). This post goes into details ...

    http://stackoverflow.com/questions/17311075/after-update-to-xcode-5-ld-symbols-not-found-for-architecture-armv7-or-armv

    Is there a way to tweak the build settings in Icenium to allow this to build?

    SOLUTION:
    This seemed to work in the IOS section of plugins.xml ...

     <source-file src="src/ios/libGoogleAdMobAds.a" framework="true" target-dir="libs" compiler-flags="-fno-objc-arc"/>

    You also need to add all of the .h header files in the plugins.xml otherwise it won't build.


  17. Alen
    Alen avatar
    7 posts
    Member since:
    Aug 2013

    Posted 31 Oct 2013 Link to this post

    Ned - This is a great writeup but I'm still missing something that's probably super simple...

    In Step 5 you explain to add that line to both plugins.xml in docroot and in res/xml/plugins.xml. Unfortunately I can't find those files. Where within the Icenium app do I find those files or where in Icenium would I make both of those edits?

    thank you!
  18. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 01 Nov 2013 Link to this post

    Hello,

    The instructions Ned gave are for a Cordova app, while the Icenium project structure differs. You only need to edit one plugin.xml file which is located at the root of the AdMob plugin in the Plugins folder. For more information refer to the following articles from our documentation:
    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  19. Alen
    Alen avatar
    7 posts
    Member since:
    Aug 2013

    Posted 01 Nov 2013 Link to this post

    Thanks Steve. It was working in a test environment for me just fine but wanted to be sure there wasn't something else I was missing. Exactly what I needed to hear!
  20. Sylwester
    Sylwester avatar
    2 posts
    Member since:
    Dec 2013

    Posted 15 Dec 2013 Link to this post

    Hello guys,

    I'm too trying to add this plugin to my project, but without any success.
    I've already read the whole documentation and it seems the following plugin:
    https://github.com/floatinghotpot/cordova-plugin-admob
    is compatible out of the box. From the discussion I understand there are no other steps required, other than importing the archive downloaded.

    So I'm importing the plugin, deleting any unrelated files like .gitignore, README, etc. Only www and src is left.
    The plugin even includes a test folder, so I'm using this as my test code.

    I did not want to mess up anything, so I've started with a new blank project.
    I've imported the plugin and built for android. Sent the APK to my phone and it's not working.
    The test reports AdMob was not loaded.

    I have no idea why. I did everything from fresh beginning.
    Any clues?

    Thanks in advance.
  21. Sylwester
    Sylwester avatar
    2 posts
    Member since:
    Dec 2013

    Posted 15 Dec 2013 Link to this post

    Ok, so apparently the test folder contains invalid code.
    It checks for window.AdMob, where the JS is exported as window.plugins.AdMob.
  22. Yi
    Yi avatar
    6 posts
    Member since:
    Jul 2013

    Posted 03 Jan 2014 Link to this post

    The code should be like this.

            if( window.plugins.AdMob ) {
                var adIdiOS = 'XXXXXXXX';
                var adIdAndroid = 'XXXXXXXXX';
                var adId = (navigator.userAgent.indexOf('Android') >=0) ? adIdAndroid : adIdiOS;
                
            var am = window.plugins.AdMob;
            am.createBannerView( 
            {
            'publisherId' : adId,
    'adSize' : am.AD_SIZE.BANNER,
    'bannerAtTop' : true
            }, 
  23. julitogtu
    julitogtu avatar
    8 posts
    Member since:
    Sep 2009

    Posted 20 Feb 2014 Link to this post

    HI everyone, I'm trying ti use this plugin, but I have a problem when I use:
    window.plugins.AdMob I received the message :TypeError: Cannot read property AdMob or undefined

    if I try with:
    window.AdMob the plugin is no loaded, so I see the msg AdMob plugin is not loaded.

    I import the plugin and follow the instructions.

    Please help me!

    Regards
  24. julitogtu
    julitogtu avatar
    8 posts
    Member since:
    Sep 2009

    Posted 20 Feb 2014 Link to this post

    Hi guys, I can solve my problem, I use window.plugins.AdMob and algo made some fews changes to load the plugin.

    Thanks!
  25. Josh
    Josh avatar
    3 posts
    Member since:
    Jun 2013

    Posted 19 Mar 2014 Link to this post

    Hey everyone,
    I seem to be having some trouble getting this going as well. I'm getting a Server exception Build failed when trying to build for android in Mist. It will build fine for iOS.

    These are the steps I followed...
    - I started a blank project.
    - downloaded the zip file from here https://github.com/floatinghotpot/cordova-plugin-admob
    - added the plugin in Mist by right clicking on the Plugins then Import plugin. I selected the zip I downloaded.
    - I moved the index.html and the main.js from the Plugins\cordova-plugin-admob-master\test folder to the root
    - I edited the main.js file and replaced all instances of window.AdMob with window.plugins.AdMob
    - This is where I first tried to build and got the error.
    - So, I downloaded the GoogleAdMobAdsSdk-6.4.1.jar and placed it in the cordova-plugin-admob-master\src\android directory
    - I edited the plugin.xml and added <source-file src="src/android/GoogleAdMobAdsSdk-6.4.1.jar" target-dir="libs" /> after the engines node
    - Tried again to build with no luck.

    Does anyone have any ideas to get this to work? Also, is there a log file in Mist that could shed some light on this? Any help would be greatly appreciated.

    Thanks!
    Josh






    - I edited the main.js file and replaced all instances of window.AdMob with window.plugins.AdMob




  26. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 24 Mar 2014 Link to this post

    Hi Josh,

    Below are the steps you have to follow in order to implement the plugin:
    1. Make a blank project.
    2. Download and add the plugin in Mist by right clicking on the Plugins then Import plugin. The zip can be found here.
    3. Add this file android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar to Plugins > cordova-plugin-admob-master >src > android > libs folder.
    4. Add <source-file src="src/android/libs/google-play-services.jar" target-dir="libs" /> inside <platform name="android"> tag in Plugins > cordova-plugin-admob-master > plugin.xml.
    5. In the same file as above find and replace the version from this tag <config-file target="AndroidManifest.xml" parent="/manifest/application">
                  <meta-data android:name="com.google.android.gms.version"
                      android:value="@integer/google_play_services_version"/>
              </config-file>
      to the version from this file on your system android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/res/values/version.xml
    6. If you want to use the test files from Plugins > cordova-plugin-admob-master > test folder edit the main.js file and replace all instances of window.AdMob with window.plugins.AdMob

    I hope I haven't missed some of the steps.
    Thanks.



    Regards,
    Zdravko
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET. Seats are limited.

     
  27. Josh
    Josh avatar
    3 posts
    Member since:
    Jun 2013

    Posted 28 Mar 2014 in reply to Zdravko Link to this post

    Thanks Zdravko for the instructions. Just a couple of questions.

    - where do I get the google-play-services.jar file? Please keep in mind I'm a fairly new to all this and confused.
    - does the android-sdk need to be added to mist somehow?

    Thanks!
  28. Josh
    Josh avatar
    3 posts
    Member since:
    Jun 2013

    Posted 01 Apr 2014 in reply to Josh Link to this post

    I was able to get the google-play-services.jar file from this plugin...

    https://github.com/MobileChromeApps/google-play-services

    I got it to build, but the ad isn't showing. Just a blank space where it should be.
  29. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 02 Apr 2014 Link to this post

    Hi Josh,

    The .jar file is a part of Android SDK and you can find it by following the path in my previous reply after the SDK is installed on your system. You have to add only the .jar file to the indicated position in your app.

    For further adjustments to the plugin or Google service please contact respectively plugin's developers or Google support as this is not in the scope of our support service.
    Thanks.

    Regards,
    Zdravko
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  30. Joris
    Joris avatar
    1 posts
    Member since:
    Mar 2012

    Posted 05 Apr 2014 in reply to Zdravko Link to this post

    Hi Zdravko,
    I followed your suggestions and I'm happy to say Android does build now.
    The "only" problem is that window.plugins.AdMob == undifined.
    I've srearched trough the posts and links suggested in the post but I can't seem to find what I'm doing wrong.

    I suspect it has something to do with the plugin.xml so I've added it below.

    Help is greatly appreciated.



    <?xml version="1.0" encoding="UTF-8"?>
     
        id="com.rjfun.cordova.plugin.admob"
        version="1.1">
     
        <name>AdMob</name>
        <description>Add AdMob support</description>
        <author>Liming Xie</author>
        <license>MIT</license>
     
        <engines>
            <engine name="cordova" version=">=2.9" />
        </engines>
        <plugin name='AdMob' value='com.google.cordova.plugin.admob'/>
        <js-module src="www/AdMob.js" name="AdMob">
            <clobbers target="window.plugins.AdMob" />
        </js-module>
        <source-file src="src/android/GoogleAdMobAdsSdk-6.4.1.jar" target-dir="libs" />
     
        <!-- android -->
        <platform name="android">
            <source-file src="src/android/google-play-services.jar" target-dir="libs" />
            <config-file target="res/xml/config.xml" parent="/*">
                <feature name="AdMob">
                    <param name="android-package" value="com.rjfun.cordova.plugin.AdMob"/>
                </feature>
            </config-file>
            <config-file target="AndroidManifest.xml" parent="/manifest/application">
                <meta-data android:name="com.google.android.gms.version"
                        android:value="4323030"/>
            </config-file>
            <config-file target="AndroidManifest.xml" parent="/manifest/application">
                <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
                        android:name="com.google.android.gms.ads.AdActivity" />
            </config-file>
            <config-file target="AndroidManifest.xml" parent="/*">
                <uses-permission android:name="android.permission.INTERNET"/>
                <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
            </config-file>
     
            <source-file src="src/android/AdMob.java" target-dir="src/com/rjfun/cordova/plugin" />
        </platform>
     
        <!-- ios -->
        <platform name="ios">
            <config-file target="config.xml" parent="/*">
                <feature name="AdMob">
                    <param name="ios-package" value="CDVAdMob" />
                </feature>
            </config-file>
     
            <header-file src="src/ios/CDVAdMob.h" />
            <source-file src="src/ios/CDVAdMob.m" />
     
            <header-file src="src/ios/GADAdMobExtras.h" />
            <header-file src="src/ios/GADAdNetworkExtras.h" />
            <header-file src="src/ios/GADAdSize.h" />
            <header-file src="src/ios/GADBannerView.h" />
            <header-file src="src/ios/GADBannerViewDelegate.h" />
            <header-file src="src/ios/GADInterstitial.h" />
            <header-file src="src/ios/GADInterstitialDelegate.h" />
            <header-file src="src/ios/GADRequest.h" />
            <header-file src="src/ios/GADRequestError.h" />
            <source-file src="src/ios/libGoogleAdMobAds.a" framework="true" />
     
            <framework src="StoreKit.framework" />
            <framework src="AudioToolbox.framework" />
            <framework src="MessageUI.framework" />
            <framework src="SystemConfiguration.framework" />
            <framework src="CoreGraphics.framework" />
            <framework src="AdSupport.framework" />
        </platform>
     
    </plugin>

Back to Top