0
votes

i have created a simple app in phonegap and published it on playstore .i also link it with Google admob account and choose the two ads type banner and interstitial ads ,But when anyone opens my app it doesn't showing any ads or banners .please help me what can i do .I have Build my app using Html ,Css And jquery

1

1 Answers

0
votes

To show ads in your app the easiest way is to use a plugin. Here you can find the working one: https://github.com/appfeel/admob-google-cordova. To use in Phonegap Build, place the following tag in your config.xml file:

<gap:plugin name="cordova-admob" source="npm"/>

Or to use in local phonegap app:

cordova plugin add cordova-admob

Then in your js code:

function onDeviceReady() {
  document.removeEventListener('deviceready', onDeviceReady, false);

  // Set AdMobAds options:
  admob.setOptions({
    publisherId:          "ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB",  // Required
    interstitialAdId:     "ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII",  // 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);