nativescript:Admob的广告无法在生产环境中运行

时间:2020-09-10 22:54:36

标签: firebase nativescript nativescript-vue nativescript-firebase

我正在使用包括Admob的nativescript firebase软件包。在Android中进行测试时,我将androidInterstitalId设置为Google在此处列出的测试ID:https://developers.google.com/admob/android/test-ads。我还将testing标志设置为true。这一切都按预期工作。在准备生产时,我输入了真实的间隙广告的值,将testing标志设置为false,并确保我的AndroidManifest.xml具有以下代码:

    <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-(MY ID)"/>

我的应用开始投入生产,但广告无法播放。插页式视频是几天前创建的,因此并不新鲜。下面是我的代码,但是我认为它不是代码,因为它在本地工作-只是不在生产环境中。

mounted() {
   setTimeout(() => {
        this.showBanner();
   }, 2000);
},
methods: {
          showBanner: function() {
                firebase.admob.preloadInterstitial({
                     iosInterstitialId: "ca-app-pub-----",
                     androidInterstitialId: "ca-app-pub-(MY ID)",
                     testing: false,
                     iosTestDeviceIds: [],
                     onClosed: () => console.log("Interstitial closed"),
                     onClicked: () => console.log("Interstitial clicked"),
                     onOpened: () => console.log("Interstitial opened"),
                     onLeftApplication: () => console.log("Interstitial left application")
                }).then(() => {
                    firebase.admob.showInterstitial().then(
                      function () {
                        console.log("AdMob interstitial showing.");
                      },
                      function (errorMessage) {
                        dialogs.alert({
                          title: "AdMob error",
                          message: errorMessage,
                          okButtonText: "Hmmkay"
                        });
                      }
                  );
                })
            },

}

0 个答案:

没有答案