I've been trying to make an app using HTML, CSS, and JS using Phonegap Build, but admob ads will not show up. My JS code for showing ads is:
<script src="code.js"></script>
<script type="text/javascript">
function onDeviceReady() {
document.removeEventListener('deviceready', onDeviceReady, false);
// Set AdMobAds options:
admob.setOptions({
publisherId: "ca-app-pub-3940256099942544/6300978111", // Required
interstitialAdId: "ca-app-pub-3940256099942544/1033173712", // Optional
autoShowBanner: true, // Optional
autoShowRInterstitial: false, // Optional
});
// Start showing banners (atomatic when autoShowBanner is set to true)
admob.createBannerView();
// Request interstitial ad (will present automatically when autoShowInterstitial is set to true)
function showad(){
admob.requestInterstitialAd();
}
}
document.addEventListener("deviceready", onDeviceReady, false);
</script>
I also have the Phonegap Build plugin inside my config.xml file along with support for the gap tag, but ads just won't show, when everything else is working fine. Please help.
Here the author of
phonegap-admobplugin.Your
config.xmlshould look like this:Normally it takes some days until you can start to see ads. Some things you could verify:
admob.setOptions:autoShowRInterstitial-->autoShowInterstitial('R' is incorrect)publisherIdis deprecated in the latest version, please usebannerAdIdinstead (even though it should work anyway)You can find complete documentation in https://admob-phonegap.com