ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
494 stars 210 forks source link

Get Banner Height? #268

Open f18nfz opened 6 years ago

f18nfz commented 6 years ago

When using AdMob banners with Overlap: false it causes the screen to flicker as the webview is pushed down. Am I correct in saying that the only way round this is to set overlap as true? However when using smart_banner where the height will vary, how can we get the banner height that AdMob has returned before showing it - so that we can create the appropriate space in the WebView according to screen size? (As far as I know we can't just get device height in dp to set the banner space accordingly to save the effort of getting the returned banner height?)

svzi commented 6 years ago

@f18nfz Have you been able to solve that issue? I'm probably facing a similar issue. With overlap: false my modals push the banner from bottom to top and everything goes crazy after closing the modal. With overlap: true my modals are somewhat working, but the banner covers my bottom tabs... Either way it's not good.

f18nfz commented 6 years ago

Alas no resolution. My only imperfect workaround if using overlap:true on a bottom banner was to have a div at the bottom of my page with the style display:none and height something like 7vh (varying according to screen orientation) and using the event listener (admob.banner.events.LOAD) would change the div display to block. - The problem with this is it's hard to set the height of the div accurately without either getting back the device height in dp or the height of the banner returned by AdMob. For now I'm mostly using overlap:false as I don't want to risk AdMob disabling ad serving as banner overlapping content is against their policy. This leaves me with that ugly flicker problem when the webview is resized... I know this flickering has been an issue for a long time, I'm sure there should be a solution or workaround - anyone have any suggestions?

svzi commented 6 years ago

@f18nfz Thanks a lot for your detailed feedback. 👍

But I feel sad to read that. Hopefully I will find a solution for my issue...

Lenndev commented 6 years ago

i have no solution for getting the banner height, i guess this is not possible at all, unless it is set as a property in a callback object of the LOAD evenListener Callback... but what might help is hiding the banner before showing the modal, and showing it on closing the modal? it won't be the a neat solution, but maybe it gives you a UX you like more

syonip commented 5 years ago

I've added banner height to the LOAD event payload, created PR: https://github.com/ratson/cordova-plugin-admob-free/pull/361