Giter VIP home page Giter VIP logo

cordova-plugin-mopub's Introduction

MoPub Plugin Pro

Present MoPub Ads in Mobile App/Games natively from JavaScript.

Highlights:

  • Easy-to-use APIs. Display Ad with single line of Js code.
  • Support Banner, Interstitial Ad, and Video Ad.
  • One plugin supports both Android and iOS platform.
  • Multiple banner size, also support custom size.
  • Fixed and overlapped mode.
  • Auto fit on orientation change.
  • Actively maintained, prompt support.

Compatible with:

  • Cordova CLI, v3.5+
  • Intel XDK and Crosswalk, r1095+
  • IBM Worklight, v6.2+

How to use?

If use with Cordova CLI:

cordova plugin add com.rjfun.cordova.mopub

If use with Intel XDK: Project -> CORDOVA 3.X HYBRID MOBILE APP SETTINGS -> PLUGINS AND PERMISSIONS -> Third-Party Plugins -> Add a Third-Party Plugin -> Get Plugin from the Web, input:

Name: MoPubPluginPro
Plugin ID: com.rjfun.cordova.mopub
[x] Plugin is located in the Apache Cordova Plugins Registry

Quick Start Example Code

Step 1: Prepare your MoPub publisher Id for your app, create it in MoPub website

var ad_units = {
	ios : { 
		banner:"agltb3B1Yi1pbmNyDAsSBFNpdGUY8fgRDA",
		interstitial:"agltb3B1Yi1pbmNyDAsSBFNpdGUYsckMDA"
	},
	android : {
		banner:"agltb3B1Yi1pbmNyDAsSBFNpdGUY8fgRDA",
		interstitial:"agltb3B1Yi1pbmNyDAsSBFNpdGUYsckMDA"
	}
};

// select the right Ad Id according to platform
var adid = (/(android)/i.test(navigator.userAgent)) ? ad_units.android : ad_units.ios;

Step 2: Create a banner with single line of javascript

// it will display smart banner at top center, using the default options
if(MoPub) MoPub.createBanner( adid.banner );

Or, show the banner Ad in some other way:

// or, show a default banner at bottom
if(MoPub) MoPub.createBanner( {
	adId: adid.banner, 
	position:MoPub.AD_POSITION.BOTTOM_CENTER, 
	autoShow:true} );

Step 3: Prepare an interstitial, and show it when needed

// preppare and load ad resource in background, e.g. at begining of game level
if(MoPub) MoPub.prepareInterstitial( {adId:adid.interstitial, autoShow:false} );

// show the interstitial later, e.g. at end of game level
if(MoPub) MoPub.showInterstitial();

Javascript API Overview

Methods:

// set default value for other methods
setOptions(options, success, fail);
// for banner
createBanner(adId/options, success, fail);
removeBanner();
showBanner(position);
showBannerAtXY(x, y);
hideBanner();
// for interstitial
prepareInterstitial(adId/options, success, fail);
showInterstitial();

Detailed Documentation

The APIs, Events and Options are detailed documented.

Read the detailed API Reference Documentation English.

FAQ

If encounter problem when using the plugin, please read the FAQ first.

Full Example Code

This MoPub Plugin Pro offers the most flexibility and many options.

Check the [test/index.html] (https://github.com/floatinghotpot/cordova-plugin-mopub/blob/master/test/index.html).

Screenshots

iPhone Banner iPhone Interstitial
ScreenShot ScreenShot

Credits

This MoPub Plugin Pro is published in a win-win partnership model:

  • It's FREE.
  • It's closed source.
  • 2% Ad traffic will be shared, as return for the support and maintenance effort.
  • You will get commercial-level support with high priority, prompt and professional.

If you hope to make the Ad 100% under your control and keep 100% Ad revenue, you can also consider spending $20 to get a license key to remove the 2% Ad traffic sharing. It's much cheaper than the $50 iOS only AdMob plugin for unity.

Then set the license key in options (either API setOptions, or createBanner, or prepareInterstitial):

    license: '[email protected]/xxxxxxxxxxxxxxx',

MoPub Plugin Pro is one of the best choice for HTML5/Cordova/PhoneGap/XDK/Construct2 app/games.

See Also

Cordova/PhoneGap plugins for the world leading Mobile Ad services:

More Cordova/PhoneGap plugins by Raymond Xie, click here.

Project outsourcing and consulting service is also available. Please contact us if you have the business needs.

cordova-plugin-mopub's People

Watchers

 avatar  avatar

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.