question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cordova Android Banner is displayed twice , 3 , 4 ...

See original GitHub issue

Hello, i use android 10.1.1 SDK30 CORDOVA CLI 11

when i refresh page index.html every time is create a new banner and keep the last one like the picture or open a new page like index2.html and back to index.html :

TEST

and when i use :

  banner.on('impression', async (evt) => {
    await banner.hide()
  })

the banner is not showing ,

my code :

let banner

var app= {
  initialize: function() {

    document.addEventListener('deviceready', async () => {
        await admob.start()
  	    banner = new admob.BannerAd({
            adUnitId: BannerID,
            size: 'SMART_BANNER'
        })

	//when added this function is hide banner and nothing is showing	
	banner.on('impression', async (evt) => {
            await banner.hide()
        })
        
        await banner.show()

  }, false);

    this.bindEvents();
  },

  bindEvents: function() {
      document.addEventListener('deviceready', this.onDeviceReady, false);
  },

  onDeviceReady: function() {
      app.receivedEvent('deviceready');

  },

};

i have mutiple pages index1.html index2.html … and every page it contains a unique ids please how ican to keep only one banner when load a new Page?

Thank you. @ratson

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
hisoka-samacommented, Mar 28, 2022
let banner

var app= {
  initialize: function() {

    document.addEventListener('deviceready', async () => {
        await admob.start()
  	    banner = new admob.BannerAd({
            adUnitId: BannerID,
            size: 'SMART_BANNER'
        })

	//remove this	
	//banner.on('impression', async (evt) => {
        //    await banner.hide()
       // })
        
        await banner.show()

  }, false);

    this.bindEvents();
  },

  bindEvents: function() {
      document.addEventListener('deviceready', this.onDeviceReady, false);
  },

  onDeviceReady: function() {
      app.receivedEvent('deviceready');

  },


var refreshPage = async() => {
     //hide the banner before refreshing the page
      await banner.hide();
      //refresh the page this way or any other way you prefer
      location.reload();
}
//call this when you refresh the page
//await refreshPage();
0reactions
JLWINCcommented, Apr 1, 2022

Thank you , I really appreciate this (y)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Cordova Android Banner is displayed twice , 3 , 4 ... -
Hello, i use android 10.1.1 SDK30 CORDOVA CLI 11. when i refresh page index.html every time is create a new banner and keep...
Read more >
On iOS advertising banner is displayed twice (triple ... - GitHub
This behavior occurs when the app has been in the background for a long time and very memory-intensive apps have been running during...
Read more >
DFP ads are not showing in Cordova - Google Groups
I'm using Cordova 7.1.0 to making app and using Cordova-plugin-admobpro to add DFP ads. However, DFP banner is not showing (no ads to...
Read more >
ionic 3 ios can't find sourcemaps and banner not clickable
1 Answer 1 ... Plugin conflicts with googlemaps in my case. See the workaround here. https://github.com/ratson/cordova-plugin-admob-free/issues/ ...
Read more >
Android Platform Guide - Apache Cordova
Please note that the versions listed here are for Cordova's Android ... use double -- to indicate that these are platform-specific arguments, for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found