cordova-plugin-admob-free icon indicating copy to clipboard operation
cordova-plugin-admob-free copied to clipboard

problem with banner when using a camera preview

Open maciejswis opened this issue 7 years ago • 4 comments
trafficstars

Hi, We are using your plugin and all works pretty well. Unfortunately we encounter a problem, once one would start the camera - using the cordova-plugin-camera-preview plugin - the banner is not shown any more. The scenario is: we have a banner on one page (home), and user can go to other page with camera preview, after he comes back to home page banner is gone. It is working correctly for other pages. In home page we are calling on init

admob.banner.prepare()
    .then(function () {
        return admob.banner.show();
    });

and on destroy return admob.banner.remove(); There are no errors in console during debugging. What I can see is crash (error) report from google play console:

java.lang.IllegalStateException:
  at android.view.ViewGroup.addViewInner (ViewGroup.java:4471)
  at android.view.ViewGroup.addView (ViewGroup.java:4312)
  at android.view.ViewGroup.addView (ViewGroup.java:4252)
  at android.view.ViewGroup.addView (ViewGroup.java:4225)
  at name.ratson.cordova.admob.banner.BannerExecutor$4.run (BannerExecutor.java:214)
  at android.os.Handler.handleCallback (Handler.java:761)
  at android.os.Handler.dispatchMessage (Handler.java:98)
  at android.os.Looper.loop (Looper.java:156)
  at android.app.ActivityThread.main (ActivityThread.java:6523)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:942)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:832)

$ cordova platform list

cordova-admob-sdk 0.11.1 "AdMob SDK" cordova-plugin-admob-free 0.11.0 "Cordova AdMob Plugin" cordova-plugin-camera-preview 0.9.0 "cordova-plugin-camera-preview" . . .

$ cordova --version 7.1.0

BTW When I change configuration and set overlap: true problem disappears, but that is not what I need - I would like to have turned off deliberately.

maciejswis avatar Nov 24 '17 09:11 maciejswis

Thanks for reporting this. Looks like you have a special use case, I don't have time to implement it, feel free to send a PR to improve it.

ratson avatar Nov 25 '17 01:11 ratson

Thanx for this plugin sir!.

@maciejswis if you still need a way around this issue, you can try setting toBack to false in CameraPreviewOptions.

inicklas avatar Dec 16 '17 06:12 inicklas

Thanks for hint @inicklas, unfortunately in our case we want to use toBack with true.

Anyhow thanks.

maciejswis avatar Dec 18 '17 08:12 maciejswis

same for us too, thanks @maciejswis for pointing it out we might replace admob banner by something else..

DaAlex90 avatar Dec 30 '19 20:12 DaAlex90