capacitor-community / admob

Community plugin for using Google AdMob
MIT License
205 stars 66 forks source link

Ad blocks WebView #317

Closed customautosys closed 2 months ago

customautosys commented 2 months ago

Describe the bug The ad blocks the WebView, hiding part of the user interface of my app. There does not seem to be any option in initialize() or showBanner() for the WebView to be resized when the ad is loaded and displayed.

To Reproduce

await AdMob.initialize();
let [consentInfo,trackingInfo]=await Promise.all([AdMob.requestConsentInfo(),AdMob.trackingAuthorizationStatus()]);
if(consentInfo.status===AdmobConsentStatus.REQUIRED&&trackingInfo.status==='notDetermined'){
    if(consentInfo.isConsentFormAvailable){
        consentInfo=await AdMob.showConsentForm();
    }else{
        await AdMob.requestTrackingAuthorization();
        trackingInfo=await AdMob.trackingAuthorizationStatus();
    }
}
AdMob.showBanner({
    adId:'ca-app-pub-3940256099942544/9214589741',
    adSize:BannerAdSize.ADAPTIVE_BANNER,
    position:BannerAdPosition.TOP_CENTER,
    isTesting:!!process.env.DEBUGGING,
    npa:consentInfo.status===AdmobConsentStatus.REQUIRED||trackingInfo.status!=='authorized'
});

Expected behavior The banner should not occlude my app's UI in the WebView. If I use the cordova version of https://github.com/admob-plus/admob-plus the banner does not block my UI (but I am unfortunately unable to get that working on capacitor).

Screenshots @capacitor-community/admob (blocked UI)

Screenshot_20240408_100457_Dunes of Terror

https://github.com/admob-plus/admob-plus (UI not blocked)

Screenshot_20240408_100732_Dunes of Terror

Smartphone (please complete the following information):

distante commented 2 months ago

You have to listen to the ads events and resize your app hmtl accordingly.