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

Just Testing: Fails on Interstitial BUT Banner and Video works!

Open ghost opened this issue 3 years ago • 2 comments

I just copied the code while I can set Banner and Video (in testing mode) and it works like a charm, But Interstitial fails as:

JS: Treating this deviceId as testdevice: 9627E477BBDDCCD2352E6BB85F8C052E
JS: onAdFailedToLoad: 3
JS: admob createInterstitial error: 3

and here is the code:

    admob.createInterstitial( {
        testing: true,
        androidInterstitialId: "", // add your own
        keywords: ["keyword1", "keyword2"], // add keywords for ad targeting
        onAdClosed: function () { console.log("interstitial closed") }
    } ).then(
        function() {
            console.log("admob createInterstitial done");
        },
        function(error) {
            console.log("admob createInterstitial error: " + error);
        }
    )

p.s. {N} v. 7

ghost avatar Nov 20 '20 18:11 ghost

this works btw:

    admob.preloadRewardedVideoAd({
        testing: true,
        iosAdPlacementId: "ca-app-pub-XXXXXX/YYYYY2", // add your own
        androidAdPlacementId: "ca-app-pub-AAAAAAAA/BBBBBB2", // add your own
        keywords: ["keyword1", "keyword2"], // add keywords for ad targeting
    }).then(
        function() {

            admob.showRewardedVideoAd({
                onRewarded: (reward) => {
                    console.log("onRewarded");
                    this.message = "watched rewarded video";
                },
                onRewardedVideoAdLeftApplication: () => console.log("onRewardedVideoAdLeftApplication"),
                onRewardedVideoAdClosed: () => console.log("onRewardedVideoAdClosed"),
                onRewardedVideoAdOpened: () => console.log("onRewardedVideoAdOpened"),
                onRewardedVideoStarted: () => console.log("onRewardedVideoStarted"),
                onRewardedVideoCompleted: () => console.log("onRewardedVideoCompleted"),
            }).then(
                function() {
                    console.log("RewardedVideoAd showing");
                },
                function(error) {
                    console.log("admob showRewardedVideoAd error: " + error);
                }
            )

        },
        function(error) {
            console.log("admob preloadRewardedVideoAd error: " + error);
        }
    )

I can not figure it out why Interstitial fails, but any other methods just work as expected.

ghost avatar Nov 20 '20 18:11 ghost

Did you ever figure it out? I can't even get a banner to show. The only thing I could get working was the reward video when using the preload reward video code like you have posted.

rob4226 avatar Apr 06 '21 00:04 rob4226