aliokan / cordova-plugin-admob

AdMob Phonegap Plugin for Android and iOS
MIT License
71 stars 43 forks source link

Banner and Interstitial ads do not work together #6

Open artgrape opened 10 years ago

artgrape commented 10 years ago

thanks for this great plugin! i got banner ads and interstitial ads working separately, however if i put both of them together interstateial will refresh banner, instead of load full screen ads. any suggestions would be greatly appreciated! thank you.

satishgowda28 commented 10 years ago

same issue here pls help

mbretag commented 10 years ago

also have the same issue, would be great if you could have both at once

adys123 commented 10 years ago

hi artgrape. how did you managed to make interstitial ads to work? because i can't see any ad on my phone.

artgrape commented 10 years ago

hello i used exactly thte same example code the author provided. i am moving from mopub. they have a simpler interface.

On Thu, Apr 17, 2014 at 4:46 PM, adys123 notifications@github.com wrote:

hi artgrape. how did you managed to make interstitial ads to work? because i can't see any ad on my phone.

— Reply to this email directly or view it on GitHubhttps://github.com/aliokan/cordova-plugin-admob/issues/6#issuecomment-40721998 .

adys123 commented 10 years ago

do you mean this?

admob.createInterstitialView(
 {
   'publisherId': 'INSERT_YOUR_PUBLISHER_ID_HERE'
 },
 successCallback,
 failureCallback);

well..if a insert this one, do i need i trigger or something like that? i mean when a user click a link, an add will be shown?

artgrape commented 10 years ago

sorry, won't be able to help more here, as i didn't wrote the code myself, i hired a developer to do it for me. and it didn't work at first, and i told him to look at the sample code, he did and it worked. perhaps the easiest is to just to build the sample project, get that work, then retro fit piece by piece into your own project. good luck!!

On Sat, Apr 19, 2014 at 10:13 PM, adys123 notifications@github.com wrote:

do you mean this?

admob.createInterstitialView( { 'publisherId': 'INSERT_YOUR_PUBLISHER_ID_HERE' }, successCallback, failureCallback);

well..if a insert this one, do i need i trigger or something like that? i mean when a user click a link, an add will be shown?

— Reply to this email directly or view it on GitHubhttps://github.com/aliokan/cordova-plugin-admob/issues/6#issuecomment-40879447 .

satishgowda28 commented 10 years ago

Hello people, add these lines in executeRequestAd function in AdMobPlugin.java file for interstitial ads to work

            if (adView != null) 
            {
        requestAd(isTesting, inputExtras, callbackContext);
    }
    if (intertitial != null)
            {
        requestIntertitial(isTesting, inputExtras, callbackContext);
    }
    if(intertitial == null && adView == null)
    {
        callbackContext
                .error("adView && intertitial are null. Did you call createBannerView?");
        return;
    }
ghost commented 10 years ago

I got around this my killing the banner before opening an interstitial. then killing the interstitial and recreating the banner on onDismissScreen listener

thibka commented 10 years ago

Hi, the code provided by the author isn't enough to make an interstitial. You need to requestAd in the success callback. I don't understand why the author doesn't correct the doc, it would save people a lot of time. Yet here it is :

var inter_ios_key = 'xxxxxx';
var inter_android_key = 'xxxxxx';
var interId = (navigator.userAgent.indexOf('Android') >=0) ? inter_android_key : inter_ios_key;

admob.createInterstitialView(
      {
        'publisherId': interId
      },
      function() { // success callback
        admob.requestAd(
          {
          'isTesting': false
          },
          function(){
             // success
          },
          function(){ // failure
            alert("request error");
          }
        );
      },
      function() { // failure callback
        alert('createInterstitial fail');
      }
    );
umesh25 commented 10 years ago

i try today with Interstitial ads ,@Thibka code very helpful to me. and i know how to ad banner ads already . i combine both BANNER and Interstitial and its working perfectly.