Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

admob-plus / banner show and hide / EYALIN and RATSON: PLEASE HELP!!!!!#693

Unanswered
Nuesret asked this question inQ&A
Discussion options

Hey EYALIN and RATSON!! Please help me out!!! Can't get the plugin work... what am I doing wrong?! Please don't tell me, that I have to add the "let banner" snippet into the MainActivity file... I added it into the headers of the assets/html files...

...ended here:
Argh! It's not working... what am I doing wrong?

This is the situation:

  1. made my webproject in html-css-javascript
  2. build the corona project and added all components: the admob-plus plugin and androidx adapters
  3. imported the android folder in Android Studio, synced and added the necessary meta.data in manifest.xml
  4. implemented the abdmob code in MainActivity.java and checked gradle.build for actual google ads lib
  5. added the let banner snippets to the html headers in assets
let bannerdocument.addEventListener('deviceready', async () => {banner = new admob.BannerAd({adUnitId: 'ca-app-pub-xxx/yyy',})banner.on('impression', async (evt) => {await banner.hide()})await banner.show()}, false)

Result: the banner is jumping in and out and stays after an amount of time (at least, if you revisit the page again).
If I change the code in

let bannerdocument.addEventListener('deviceready', async () => {banner = new admob.BannerAd({adUnitId: 'ca-app-pub-xxx/yyy',})banner.on('impression', async (evt) => {await banner.hide()})await banner.show()}, true)

...the banner is showing up and stays. BUT... this works fine as long as the user opens the pages in a linear way. If he revisits the page - the same banner duplicates itself and jump over the old one: now we see two identical banners at the bottom. This goes on and on... till the whole page is covered with the same banner.

Hey guys, how do you manage it to work? Did I forget to add code somewhere? Please help. I need really help.

Found this and placed it into header of the html where the banner should appearing but it isn't working
https://github.com/admob-plus/admob-plus/issues/450

function initBanner(id) {  let banner = new admob.BannerAd({    adUnitId: 'ca-app-pub-xxxxxxxx' ,    position: 'bottom',    npa: status,    id: id ? Number.parseInt(id) : null  });  banner.on('load', (ex) => {    localStorage.setItem('lastBannerId', ex.adId);  })  return banner.show();}const lastBannerId = localStorage.getItem('lastBannerId');await initBanner(lastBannerId)  .catch(ex => {    initBanner(null)  });
You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@Nuesret

[8]ページ先頭

©2009-2025 Movatter.jp