Setup

Miquel Martín edited this page Apr 29, 2016 · 4 revisions

To install this plugin with Cordova CLI (Command-line Interface), use one of the following command lines:

  • cordova plugin add tappx-phonegap
  • cordova plugin add https://github.com/appfeel/tappx-phonegap.git

If you are using the Phonegap CLI, you should use one of the following command lines:

  • phonegap local plugin add tappx-phonegap
  • phonegap local plugin add https://github.com/appfeel/tappx-phonegap.git

To use in Phonegap Build, place the following tag in your config.xml file:

<gap:plugin name="tappx-phonegap" source="npm" />

To use with Ionic Framework, use one of the following command lines:

  • ionic plugin add tappx-phonegap
  • ionic plugin add https://github.com/appfeel/tappx-phonegap.git

With this plugin it's possible to decide how much traffic will be requested to Tappx and how much will it be requested to Tappx. To configure the amount of traffic that will be delivered to Tappx, use the setOptions javascript call.

For example, to let the plugin request Tappx ads 80% of the available impression requests, specify the following options (the remaining 20% impression requests will be requested to AdMob):

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

      // Set AdMobAds options:
      tappx.setOptions({
        publisherId:          "YOUR_ADMOB_PUBLISHER_ID",      // Required
        interstitialAdId:     "YOUR_ADMOB_INTERSTITIAL_ID",   // Optional
        tappxIdiOS:           "YOUR_TAPPX_IOS_ID",            // Optional
        tappxIdAndroid:       "YOUR_TAPPX_ANDROID_ID",        // Optional
        tappxShare:           0.8                             // Optional
      });

      // Start showing banners (will show atomatically as autoShowBanner is set to true by default)
      tappx.createBannerView();

      // Request interstitial (will present automatically as autoShowInterstitial is set to true by default)
      tappx.requestInterstitial();
    }

    document.addEventListener("deviceready", onDeviceReady, false);

Specifying tappxShare : 1, all traffic will be requested to Tappx. Specifying tappxShare: 0, all traffic will be requested to Admob. If you don't specify tappxId, no Tappx ad requests will be placed (even if you specify a tappxShare).