我正在尝试使用“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”日志,所以也许我没有很好地使用这个插件。