nativescript-admob icon indicating copy to clipboard operation
nativescript-admob copied to clipboard

View property of the CreateBanner method

Open prantikv opened this issue 7 years ago • 9 comments

Using Angular 2 along with Nativescript. But I am not sure as to what is to be passed in the view property of the admob.createBanner() method

 admob.createBanner({
          testing: true,
          view:  //What goes here??
          iosTestDeviceIds: ["yourTestDeviceUDIDs", "canBeAddedHere"],
          size: admob.AD_SIZE.SMART_BANNER,
          iosBannerId: "ca-app-pub-XXXXXX/YYYYYY", // add your own
          androidBannerId: "ca-app-pub-AAAAAAAA/BBBBBBB", // add your own
 
       margins: {
        // if both are set, top wins
        top: 100,
        //bottom:0
      }
    })

Also is it possible to show banner ads in stakLayout for example in a stacklayout have tabView I want to show banner ads between tabs and list items?

prantikv avatar Nov 23 '16 15:11 prantikv

Can you leave out the view?

I've wanted to upgrade this plugin to support defining the banner in XML for quite a while but still haven't found the time to do it..

EddyVerbruggen avatar Nov 23 '16 18:11 EddyVerbruggen

Yes I have left out the view property. But the major issue here is that the ads show up overlapping the topmost view as you have mentioned in the docs

// if this 'view' property is not set, the banner is overlayed on the current top most view

If I want to show ads at the top with top:0 then this will cover the header of my app and if I show it at the bottom with bottom:0 then it covers some list items that I might have.

As it is in cordova, the ads push the contents of the app and create their own space.

That is a better user experience as overlapping can cause false clicks.

The solutions that I would like to see (don't know if it's possible or not)

A dedicated XML tag that can be dropped in the view which is then used to show ads. Also the XML tag maybe hidden by default if ads are not available otherwise it will leave a block of empty space.

Here are some example images to illustrate this further

image 1 image 2 image 3

Hopefully you get the time. Will be waiting for the change.

-Regards

prantikv avatar Nov 24 '16 06:11 prantikv

Has any progress been made on this? @EddyVerbruggen , have you gotten around to defining the banner in XML (or create a view that will contain the banner in XML/HTML)? Thanks in advance 👍

JillevdW avatar Aug 23 '18 09:08 JillevdW

No, can't give it priority.

EddyVerbruggen avatar Aug 23 '18 09:08 EddyVerbruggen

Am I right to assume that the view property we give to the createBanner function is not used right now? Because that is what I'm trying to achieve, adding the advertisement to a view. I'd love to try and do this and then submit a pull request if I get it working.

JillevdW avatar Aug 23 '18 10:08 JillevdW

@JillevdW IIRC that's not used for positioning the banner. On Android I'm 100% sure it's not, on iOS there may be some untested code in there.

I'm sure a lot of folks will be thankful if you could pull it off. And I'll be happy to also add your changes to the Firebase plugin as it's using almost identical code and has the same feature because Google integrated AdMob into Firebase a while ago.

If you want to contribute please don't upgrade this plugin to TypeScript, or do some other heavy refactor because that won't make it easier to complete, review, and merge.

EddyVerbruggen avatar Aug 23 '18 10:08 EddyVerbruggen

Any progress on this?

MustafaCa avatar Aug 03 '19 12:08 MustafaCa

This functionality should be high priority, it would heavily improve the usability of this plugin.

leon486 avatar May 23 '20 18:05 leon486

@leon486 looking forward to your PR.

EddyVerbruggen avatar May 23 '20 19:05 EddyVerbruggen