Git Product home page Git Product logo

cordova-plugin-admob's Introduction

cordova-plugin-admob

AdMob Phonegap Plugin for Android and iOS compatible Phonegap 3.0 CLI

What is phonegap CLI ?
http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface
How to install plugin whith phonegap CLI :

phonegap local plugin add https://github.com/aliokan/cordova-plugin-admob

##Implementation:

There are two calls needed to get AdMob Ads:

  1. createBannerView

    Takes in a object containing a publisherId and adSize, as well as success and failure callbacks. An example call is provided below:

      admob.createBannerView(
          {
            'publisherId': 'INSERT_YOUR_PUBLISHER_ID_HERE',
            'adSize': admob.AD_SIZE.BANNER
          },
          successCallback,
          failureCallback
      );
    
  2. requestAd

    Takes in an object containing an optional testing flag, and an optional list of extras. This method should only be invoked once createBannerView has invoked successCallback. An example call is provided below:

      admob.requestAd(
          {
            'isTesting': false,
            'extras': {
              'color_bg': 'AAAAFF',
              'color_bg_top': 'FFFFFF',
              'color_border': 'FFFFFF',
              'color_link': '000080',
              'color_text': '808080',
              'color_url': '008000'
            },
          },
          successCallback,
          failureCallback
      );
    

This plugin also allows you the option to listen for ad events. The following events are supported:

     document.addEventListener('onReceiveAd', callback);
     document.addEventListener('onFailedToReceiveAd', callback);
     document.addEventListener('onDismissScreen', callback);
     document.addEventListener('onPresentScreen', callback);
     document.addEventListener('onLeaveApplication', callback);

If you want to create an Interstitials sur createInterstitialView

     admob.createInterstitialView(
     {
       'publisherId': 'INSERT_YOUR_PUBLISHER_ID_HERE'
     },
     successCallback,
     failureCallback);

If you want Kill banner :

     admob.killAd(successCallback,failureCallback);

Based on:
https://github.com/rajpara11/phonegap-plugins/tree/master/Android/AdMobPlugin
https://github.com/rajpara11/phonegap-plugins/tree/master/iOS/AdMobPlugin
with Interstitials support

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.