Giter VIP home page Giter VIP logo

Comments (4)

EddyVerbruggen avatar EddyVerbruggen commented on June 18, 2024

Can you try fiddling with these lines to fix it?

from nativescript-admob.

calebeaires avatar calebeaires commented on June 18, 2024

Removing timeout the problem disappears!

from nativescript-admob.

Skintillion avatar Skintillion commented on June 18, 2024

I've had a problem with this plugin crashing only on certain phones and not every time.

I was able to gain a lot more stability by modifying the plugins code to only use appModule

Changed the following lines in admob.android.js from this:

if (frame_1.topmost() !== undefined) {
   frame_1.topmost().currentPage.android.getParent().addView(adViewLayout_1, relativeLayoutParamsOuter_1);
} else {
   appModule.android.foregroundActivity.getWindow().getDecorView().addView(adViewLayout_1, relativeLayoutParamsOuter_1);
}

To this:

appModule.android.foregroundActivity.getWindow().getDecorView().addView(adViewLayout_1, relativeLayoutParamsOuter_1);

After that the crashes stopped.

I even put a check for frame topmost around the firebase instantiation and that didn't help. I found that sometimes popups (permission requests) would interfere with the plugin.

If appModule works more often, why bother with the frame topmost method?

from nativescript-admob.

Skintillion avatar Skintillion commented on June 18, 2024

Ok, so if you use the appModule method, it puts the banner behind the navigation buttons.

Going back to the script....

setTimeout(function () {
  if (frame_1.topmost() !== undefined) {
    var topMost = frame_1.topmost();
    var currentPage = topMost.currentPage;
    var currentPageParent = currentPage.android.getParent();
    console.log(currentPageParent); // null
    currentPageParent.addView(adViewLayout_1, relativeLayoutParamsOuter_1);

Even though it finds frame_1.topmost(), the current page parent is null, causing an error when trying to addView.

from nativescript-admob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.