javascript - 在 Cordova 中实施 AdMob 广告
问题描述
我在从 AdMob 平台到使用 Cordova 框架编写的应用程序中执行广告时遇到问题。一开始我安装了cordova-admob插件。我已将下面的代码粘贴到 index.js 文件中。将应用程序编译为android版本后,没有广告出现。请帮忙。
function onDeviceReady() {
document.removeEventListener('deviceready', onDeviceReady, false);
// Set AdMobAds options:
admob.setOptions({
publisherId: "MY APP ID", // Required
interstitialAdId: "MY AD ID" // Optional
});
// Start showing banners (atomatic when autoShowBanner is set to true)
admob.createBannerView();
// Request interstitial (will present automatically when autoShowInterstitial is set to true)
admob.requestInterstitialAd();
}
document.addEventListener("deviceready", onDeviceReady, false);
解决方案
推荐阅读
- reactjs - 如何在 React 应用程序中安装/设置 Eslint、Prettier?
- java - 当我退出当前活动或离开应用程序时如何停止媒体播放器?
- html - Django模板:同一行上有两种不同的字体大小
- regex - 正则表达式替换字符串,我做错了什么?
- reactjs - SwitchTransition 不适用于常规 html 按钮
- python - 在 python 列表中查找单个唯一值
- javascript - 尝试转换为 mp3 时产生 ENOENT 错误
- javascript - 无法从网页导入
- firebase - 如何在表格中正确对齐显示来自 firebase 的数据。?使用 React Native。?
- python - 如何使用 tensor_scatter_nd_add