Mmedia Advertisement integration in Mobile


Mmedia is a best advertisement tools for any platform to showing ads. I have done it for iOS and Android Plateform and its working fine.

Please refer below codes for Titanium Studio Mmedia AdView integration.

/*——-  MMEDIA ADVIEW INTEGRATION IN APP BOTTOM ———*/

var MillennialMedia = require(‘ti.millennialmedia’);

// Set the log level on the module

MillennialMedia.setLogLevel(MillennialMedia.LOG_LEVEL_VERBOSE);

MillennialMedia.geolocation = {

latitude : 41.866,

‘longitude’ : 88.107

};

// Set demographics using module constants

MillennialMedia.demographics = {

age : ’23’,

gender : MillennialMedia.GENDER_MALE,

education : MillennialMedia.EDUCATION_SOME_COLLEGE,

ethnicity : MillennialMedia.ETHNICITY_HISPANIC,

maritalStatus : MillennialMedia.MARITAL_DIVORCED,

orientation : MillennialMedia.SEXUAL_ORIENTATION_STRAIGHT,

zipCode : ‘60187’

};

 

MillennialMedia.custom = {

something : “CUSTOM1”,

‘somethingelse’ : “CUSTOM2”

};

 

MillennialMedia.keywords = [‘KEYWORD1’, ‘KEYWORD2’];

 

/**

 * Here we demonstrate the different events available

 */

function curryEventHandler(type) {

return function() {

Ti.API.info(type + ‘ fired!’);

};

}

 

 

 

// ‘applicationWillTerminateFromAd’, ‘modalWillAppear’, and ‘modalWillDismiss’ are

// iOS only, but it does not hurt to add their listeners on Android.

var events = [‘adRequestComplete’, ‘applicationWillTerminateFromAd’, ‘adWasTapped’, ‘modalWillAppear’, ‘modalDidAppear’, ‘modalWillDismiss’, ‘modalDidDismiss’];

for (var k in events) {

MillennialMedia.addEventListener(events[k], curryEventHandler(events[k]));

}

 

MillennialMedia.addEventListener(‘adRequestComplete’, function(e) {

if (!e.success) {

alert(‘Request Error: ‘ + e.error);

}

});

//Ti.include(‘bottom.js’);

/**

 * We’ll create an ad at the bottom of our app. This ad will demonstrate the different

 * events that are available.

 */

// END OF MMEDIA AD VIEW INTEGRATION —->

For Adding framework of mmedia.com you can download it from the titanium modules store free.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s