Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interstitial ad not showing #57

Open
fvci2015 opened this issue Mar 7, 2019 · 7 comments
Open

Interstitial ad not showing #57

fvci2015 opened this issue Mar 7, 2019 · 7 comments

Comments

@fvci2015
Copy link

fvci2015 commented Mar 7, 2019

@EddyVerbruggen sir i have added admob plugin.
create banner is working fine. but interstitial ad not showing. i have checked ad units properly. no mistake in ad units. please guide where i did a mistake.

my package:

{
  "nativescript": {
    "id": "org.nativescript.adstest",
    "tns-ios": {
      "version": "5.2.0"
    },
    "tns-android": {
      "version": "5.2.1"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN ",
  "repository": "",
  "dependencies": {
    "@angular/animations": "~7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/http": "~7.2.0",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "nativescript-admob": "^3.3.2",
    "nativescript-angular": "~7.2.1",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "~0.1.12",
    "rxjs": "~6.3.0",
    "tns-core-modules": "~5.2.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~7.2.0",
    "@nativescript/schematics": "~0.5.0",
    "@ngtools/webpack": "~7.2.0",
    "nativescript-dev-typescript": "~0.8.0",
    "nativescript-dev-webpack": "~0.20.0"
  },
  "gitHead": "f548ec926e75201ab1b7c4a3a7ceefe7a4db15af",
  "readme": "NativeScript Application"
}

**test.component.ts **

import { createBanner,showInterstitial, preloadInterstitial  } from "nativescript-admob";
----other stuff----
-----
private androidBannerId: string = "ca-app-pub-xxx";
private androidInterstitialId: string = "ca-app-pub-xxxx";
private androidVideoRewardId: string = "ca-app-pub-xxxxx";

createbanner_method(){
        createBanner({
                              // if this 'view' property is not set, the banner is overlayed on the current top most view
                              // view: ..,
                              testing: false, // set to false to get real banners
                              size: admob.AD_SIZE.SMART_BANNER, // anything in admob.AD_SIZE, like admob.AD_SIZE.SMART_BANNER
                              iosBannerId: "ca-app-pub-XXXXXX/YYYYYY", // add your own
                              androidBannerId: this.androidBannerId, // add your own
                              // Android automatically adds the connected device as test device with testing:true, iOS does not
                              iosTestDeviceIds: ["yourTestDeviceUDIDs", "canBeAddedHere"],
                              margins: {
                                // if both are set, top wins
                                //top: 10
                                bottom: 0
                              },
                              keywords: []  // add keywords for ad targeting
                            }).then(
                                function() {
                                  console.log("admob createBanner done");                              
                                },
                                function(error) {
                                  console.log("admob createBanner error: " + error);
                             }
                       )
      }  
      preloadInter_method(){
              preloadInterstitial({
                testing: false,
                iosInterstitialId: "ca-app-pub-XXXXXX/YYYYY2", // add your own
                androidInterstitialId: this.androidInterstitialId, // add your own
                // Android automatically adds the connected device as test device with testing:true, iOS does not
                iosTestDeviceIds: ["ce97330130c9047ce0d4430d37d713b2"],
                keywords: [], // add keywords for ad targeting
                onAdClosed: function () { console.log("interstitial closed") }
              }).then(
                  function() {
                    console.log("interstitial preloaded - you can now call 'showInterstitial' whenever you're ready to do so");
                  },
                  function(error) {
                    console.log("admob preloadInterstitial error: " + error);
                  }
            )
      }
      showInter_method(){
        showInterstitial().then( 
          function() {
            // this will resolve almost immediately, and the interstitial is shown without a delay because it was already loaded
            console.log("interstitial showing");          
            
          },
          function(error) {
            console.log("admob showInterstitial error: " + error);        
          }
    )
      }

test.component.html:

 <StackLayout >
             <Button text="create banner" (tap)="createbanner_method()"></Button>    
             <Button text="load inter" (tap)="preloadInter_method()"></Button>
             <Button text="show inter" (tap)="showInter_method()"></Button>   
   </StackLayout>

Output i am getting:

admob createBanner done  // banner ad showing

onAdFailedToLoad: 3
admob preloadInterstitial error: 3

Please help i really stuck. thanks in advance

@EddyVerbruggen
Copy link
Owner

Does the demo app's interstitial work?

@fvci2015
Copy link
Author

fvci2015 commented Mar 7, 2019

i did not check the demo app

@EddyVerbruggen
Copy link
Owner

OK, I'll wait for you to check that out then.

@fvci2015
Copy link
Author

fvci2015 commented Mar 7, 2019

ok thank you sir, i will back to you after checking the demo app

@fvci2015
Copy link
Author

fvci2015 commented Mar 7, 2019

sir no luck. i have run demo app. In testing mode, working fine.
but in real time (testing:false) not working
showing Error preloading interstitial : 3

@EddyVerbruggen
Copy link
Owner

Did you Google that error?

@fvci2015
Copy link
Author

fvci2015 commented Mar 7, 2019

I don't know what i did mistake.
Steps i did:
Step1: Deleted node modules folder and run "npm install"
Step2: I have removed and added android platform again.
In emulator ads are not showing sometimes. But Real mobile device banners ads, intersitial ads showing properly.
Finally problem solved.
@EddyVerbruggen sir, my device hangs up to 3 secs after intersitial ad. can you suggest when this type of issue occurs??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants