@nadimemon wrote:
I am using floatinghotpot plugin to show ads
**cordova plugin add https://github.com/floatinghotpot/cordova-plugin-admob.git **
This is my code for admob$ionicPlatform.ready(function($location) { var adMobId = { admob_banner_key: 'ca-app-pub-3378914045953959/7363511027' }; var options = { interstitialAdId: 'ca-app-pub-3940256099942544/1033173712', autoShow: true }; var adMobPosition = { BOTTOM_CENTER: 8 }; $scope.showBannerAd = function() { try { console.log('Show Banner Ad'); $cordovaAdMob.createBannerView({ adId: adMobId.admob_banner_key, position: adMobPosition.BOTTOM_CENTER, isTesting: true, autoShow: true }); } catch (e) { alert(e); } } $scope.showInterstitialAd = function(st) { try { console.log('Show Interstitial Ad'); $cordovaAdMob.createInterstitialView(options, function() { admob.requestInterstitialAd({ 'isTesting': true }, function() { admob.showAd(true); }, function(error) { console.log('failed to request ad ' + error); } ); }, function() { console.log('failed to create Interstitial view'); }); } catch (e) { alert("ALAS"); } } });
But when I call showBannerAd() using ng-init="showBannerAd()" it does not show ads and show this error message. How can I solve this problem? Am I missing anythinh important?
TypeError: Cannot read property 'AdMob' of undefinedThis is the lists of installed plugins
com.google.admobsdk 6.12.2 "AdMob SDK for Android, iOS and WP8"
cordova-plugin-admob 2.10.0 "AdMob Plugin Pro"
cordova-plugin-console 1.0.2 "Console"
cordova-plugin-device 1.1.0 "Device"
cordova-plugin-extension 1.2.3 "Cordova Plugin Extension"
cordova-plugin-googleplayservices 19.0.3 "Google Play Services for Android"
cordova-plugin-inappbrowser 1.1.1 "InAppBrowser"
cordova-plugin-network-information 1.1.0 "Network Information"
cordova-plugin-splashscreen 3.0.0 "Splashscreen"
cordova-plugin-statusbar 2.0.0 "StatusBar"
cordova-plugin-whitelist 1.2.0 "Whitelist"
ionic-plugin-keyboard 1.0.8 "Keyboard"
Posts: 1
Participants: 1