1

「nativescript-admob」を使用してアプリにadmobを追加しようとしています。今のところコードは次のとおりです。

<template>
  <Page class="page">
   <StackLayout class="hello-world">
    <Label text="my home page"/>
  </StackLayout>
 </Page>
</template> 

<script>
const admob = require("nativescript-admob");
export default  {   
  mounted() {
    admob.createBanner({
   // if this 'view' property is not set, the banner is overlayed on the current top most view
   // view: ..,
   testing: true, // set to false to get real banners
   size: admob.AD_SIZE.SMART_BANNER, // anything in admob.AD_SIZE, like admob.AD_SIZE.SMART_BANNER
   androidBannerId: "ca-app-pub-AAAAAAAAAAA/AAAAAAAAA", // add your own
   margins: {
    // if both are set, top wins
    //top: 10
    bottom: 50
  },
  }).then(
    function() {
      console.log("admob createBanner done");
    },
   function(error) {
     console.log("admob createBanner error: " + error);
    }
 )
},

}
</script>

「マウント」でadmobを起動しようとしましたが、うまくいきません.admobをこのようにnativescript-vueと統合した人はいますか? 私の場合、「admob createBanner done」というログも表示されないため、このプラグインをうまく使用していない可能性があります。

4

1 に答える 1