Giter VIP home page Giter VIP logo

cordova-plugin-flurry's Introduction

cordova-plugin-flurry

=====================

Cordova plugin to support Flurry (analytics and advertisement)

It's targeted to build with cordova 3.5.

Currently, it works on:

  • iOS, tested on iphone/ipad iOS7.
  • Android, tested on 4.4.

See Also


Besides using Flurry Ad, you have some other options, all working on cordova:

How to use?


To install this plugin, follow the Command-line Interface Guide.

cordova plugin add https://github.com/floatinghotpot/cordova-plugin-flurry.git

Note: ensure you have a proper Flurry account and create an Id for your app.

Quick example with cordova command line tool


cordova create testflurry com.agamemnus.testflurry TestFlurry
cd testflurry
cordova platform add android
cordova platform add ios
cordova plugin add https://github.com/floatinghotpot/cordova-plugin-flurry.git
rm -r www/*
cp plugins/com.agamemnus.cordova.plugin.flurry/test/index.html www/
cordova prepare; cordova run android; cordova run ios; 
... cordova emulate android/ios, or import the android project into eclipse or ios project into xcode

Or, just clone the testflurry project from github:

git clone [email protected]:floatinghotpot/testflurry.git

Example javascript


Call the following code inside onDeviceReady(), because only after device ready you will have the plugin working. (almost same as cordova-plugin-admob, just plugin name and app key from Ad vendor different)

var flurry_ios_key = '2DYY249X5G798HMF3MTH';
var flurry_android_key = 'G56KN4J49YT66CFRD5K6';
var adId = (navigator.userAgent.indexOf('Android') >=0) ? flurry_android_key : flurry_ios_key;

if( window.plugins && window.plugins.Flurry ) {
    var am = window.plugins.Flurry;

    am.createBannerView( 
        {
        'publisherId': adId,
        'adSize': am.AD_SIZE.BANNER,
        'bannerAtTop': false
        }, 
        function() {
    	    am.requestAd(
    		    { 'isTesting':true }, 
        		function(){
        			am.showAd( true );
        		}, 
        		function(){ alert('failed to request ad'); }
        	);
        }, 
        function(){ alert('failed to create banner view'); }
    );
    
    am.createInterstitialView(
          {
              'publisherId': adId,
          },
          function() {
              am.requestInterstitialAd( { 'isTesting':true }, function() {
              }, function() { alert('failed to request ad'); });
          },
          function() {
              alert("Interstitial failed");
          }
      );
    
} else {
  alert('Flurry plugin not available/ready.');
}

More ...


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

	// more callback to handle Ad events
	document.addEventListener('onReceiveAd', function(){
	});
	document.addEventListener('onFailedToReceiveAd', function(data){
		// alert( data.error );
	});
	document.addEventListener('onPresentAd', function(){
	});
	document.addEventListener('onDismissAd', function(){
	});
	document.addEventListener('onLeaveToAd', function(){
	});   

See the working example code in demo under test folder

Screenshots, Banner and Interstitial Ads


iPhone

Screenshot

iPad, Landscape

Screenshot

Android

Screenshot

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-flurry's People

Contributors

agamemnus avatar floatinghotpot avatar

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.