AndriousSolutions / ads

Other
58 stars 11 forks source link

unable to initialize both banner and interestial ad in same page #5

Closed cimplesid closed 5 years ago

Andrious commented 5 years ago

More information is required.

cimplesid commented 5 years ago
Ads.init('ca-app-pub-3888198890022370/4350812398',
        testDevices: ['CB65990782275C7C445F0130F913B23B']);//banner
    Ads.init(
      'ca-app-pub-3888198890022370/8713206535',
      testDevices: ['CB65990782275C7C445F0130F913B23B'],
    );//interestial
    Ads.eventListener = (MobileAdEvent event) {
      switch (event) {
        case MobileAdEvent.loaded:
          print('loaded');
          break;

        case MobileAdEvent.failedToLoad:
          print('failed to loaded ');
          break;
        case MobileAdEvent.clicked:
          break;
        case MobileAdEvent.impression:
          break;
        case MobileAdEvent.opened:
          break;
        case MobileAdEvent.leftApplication:
          break;
        case MobileAdEvent.closed:
          // TODO: Handle this case.
          break;
      }
    };

    Ads.showBannerAd(state: this, anchorOffset: 20);
    Ads.showFullScreenAd(state: this);

if i run this code only interestial ad runs not banner if i comment the interestial then banner works and vice versa

Andrious commented 5 years ago

Yes, they've made changes on me... Please, ensure you've provided three sepearate id's from AdMob. The main 'app id' and one 'banner unit id' and one 'interestial unit id'

Use the latest package, v. 0.4.0

Turn to Create a Banner Ad Unit for further instructions. Remember, there's an id now for every 'type' of ad on top of an 'app id' for the whole firebase AdMob plugin. This was not the case months ago.

     Ads.init('ca-app-pub-3940256099942544/6300978111',
        testDevices: ['CB65990782275C7C445F0130F913B23B']);//banner and interestial

    Ads.setBannerAd(adUnitId: 'ca-app-pub-3888198890022370/4350812398');

    Ads.setFullScreenAd(adUnitId: 'ca-app-pub-3888198890022370/8713206535'); 

    Ads.eventListener = (MobileAdEvent event) {
      switch (event) {
        case MobileAdEvent.loaded:
          print('loaded');
          break;

        case MobileAdEvent.failedToLoad:
          print('failed to loaded ');
          break;
        case MobileAdEvent.clicked:
          break;
        case MobileAdEvent.impression:
          break;
        case MobileAdEvent.opened:
          break;
        case MobileAdEvent.leftApplication:
          break;
        case MobileAdEvent.closed:
          // TODO: Handle this case.
          break;
      }
    };

    Ads.showBannerAd(state: this, anchorOffset: 20);
    Ads.showFullScreenAd(state: this);
cimplesid commented 5 years ago

As i was into the code of plugin there BannerAd({ @required String adUnitId, @required this.size, MobileAdTargetingInfo targetingInfo, MobileAdListener listener, }) : super( adUnitId: adUnitId, targetingInfo: targetingInfo, listener: listener); is there any way to use ad in custom places like in between the list view...? BannerAd( adUnitId: 'ca-app-pub-3888198890022370/4350812398', size: AdSize.largeBanner);

this code is still give me ad of size 320x50

Andrious commented 5 years ago

Not yet, no. I believe you're describing 'native ads', and the plugin is yet to support that.