Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first commit, tested on iphone, ipad, android
- Loading branch information
Liming Xie
committed
Oct 6, 2014
1 parent
c908c21
commit 458d5cb
Showing
91 changed files
with
7,633 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ignore following files | ||
.DS_Store | ||
.settings | ||
.idea | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,157 @@ | ||
cordova-plugin-mmedia | ||
===================== | ||
# mMedia (Millennial Media) Plugin Pro # | ||
|
||
Present mMedia Ads in Mobile App/Games natively from JavaScript. | ||
|
||
Highlights: | ||
- [x] Easy-to-use APIs. Display Ad with single line of Js code. | ||
- [x] Support Banner, Interstitial Ad, and Video Ad. | ||
- [x] One plugin supports both Android and iOS platform. | ||
- [x] Auto fit on orientation change. | ||
- [x] 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.mmedia | ||
``` | ||
|
||
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: mMediaPluginPro | ||
Plugin ID: com.rjfun.cordova.mmedia | ||
[x] Plugin is located in the Apache Cordova Plugins Registry | ||
``` | ||
|
||
## Quick Start Example Code ## | ||
|
||
Step 1: Prepare your mMedia Apid for your app, create it in [mMedia website](http://www.mmedia.com/) | ||
|
||
```javascript | ||
var ad_units = { | ||
ios : { | ||
banner : "177365", | ||
interstitial : "177364" | ||
}, | ||
android : { | ||
banner : "177367", | ||
interstitial : "177369" | ||
} | ||
}; | ||
|
||
// 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 | ||
|
||
```javascript | ||
// it will display smart banner at top center, using the default options | ||
if(mMedia) mMedia.createBanner({adId:adid.banner, autoShow:true}); | ||
``` | ||
|
||
Or, show the banner Ad in some other way: | ||
|
||
```javascript | ||
// or, show a default banner at bottom | ||
if(mMedia) mMedia.createBanner({ | ||
adId : adid.banner, | ||
autoShow : true, | ||
overlap : true, | ||
position : mMedia.AD_POSITION.BOTTOM_CENTER | ||
}); | ||
``` | ||
|
||
Step 3: Prepare an interstitial or video Ad, and show it when needed | ||
|
||
```javascript | ||
// preppare and load ad resource in background, e.g. at begining of game level | ||
if(mMedia) mMedia.prepareInterstitial( {adId:adid.interstitial, autoShow:false} ); | ||
|
||
// show the interstitial later, e.g. at end of game level | ||
if(mMedia) mMedia.showInterstitial(); | ||
``` | ||
|
||
## Javascript API Overview ## | ||
|
||
Methods: | ||
```javascript | ||
// 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](https://github.com/floatinghotpot/cordova-mmedia-pro/wiki). | ||
|
||
## FAQ ## | ||
|
||
If encounter problem when using the plugin, please read the [FAQ](https://github.com/floatinghotpot/cordova-mmedia-pro/wiki/FAQ) first. | ||
|
||
## Full Example Code ## | ||
|
||
This mMedia Plugin Pro offers the most flexibility and many options. | ||
|
||
Check the [test/index.html] (https://github.com/floatinghotpot/cordova-mmedia-pro/blob/master/test/index.html). | ||
|
||
## Screenshots ## | ||
|
||
iPhone Banner | iPhone Interstitial | ||
-------|--------------- | ||
![ScreenShot](docs/iphone_banner.jpg) | ![ScreenShot](docs/iphone_interstitial.jpg) | ||
iPad Banner | iPad Video Ad | ||
![ScreenShot](docs/ipad_banner.jpg) | ![ScreenShot](docs/ipad_video.jpg) | ||
Android Banner | Android Video Ad | ||
![ScreenShot](docs/android_banner.jpg) | ![ScreenShot](docs/android_video.jpg) | ||
|
||
## Credits ## | ||
|
||
This mMedia 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](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HJCR6JFWTNNFW) to remove the 2% Ad traffic sharing. | ||
It's much cheaper than [the $50 iOS only AdMob plugin for unity](https://prime31.com/plugins). | ||
|
||
Then set the license key in options (either API setOptions, or createBanner, or prepareInterstitial): | ||
```javascript | ||
license: 'username@gmail.com/xxxxxxxxxxxxxxx', | ||
``` | ||
|
||
With impressive video Ads, mMedia Plugin Pro is one of the best choice for HTML5/Cordova/PhoneGap/XDK/Construct2 app/games. | ||
|
||
## See Also ## | ||
|
||
Cordova/PhoneGap plugins for top Mobile Ad services: | ||
|
||
* [AdMob Plugin Pro](https://github.com/floatinghotpot/cordova-admob-pro), enhanced Google AdMob plugin, easy API and more features. | ||
* [mMedia Plugin Pro](https://github.com/floatinghotpot/cordova-mmedia-pro), enhanced mMedia plugin, support impressive video Ad. | ||
* [MobFox Plugin Pro](https://github.com/floatinghotpot/cordova-mobfox-pro), enhanced MobFox plugin, support video Ad and many other Ad network with server-side integration. | ||
* [iAd Plugin](https://github.com/floatinghotpot/cordova-plugin-iad), Apple iAd service. | ||
* [FlurryAds Plugin](https://github.com/floatinghotpot/cordova-plugin-flurry), Yahoo Flurry Ads service. | ||
|
||
More Cordova/PhoneGap plugins by Raymond Xie, [click here](http://floatinghotpot.github.io/). | ||
|
||
Project outsourcing and consulting service is also available. Please [contact us](http://floatinghotpot.github.io) if you have the business needs. | ||
|
||
Cordova/PhoneGap for Millennial Media Ad |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
id="com.rjfun.cordova.mmedia" | ||
version="1.0.0"> | ||
|
||
<name>mMedia Ad</name> | ||
<description>Cordova/PhoneGap plugin for mMedia, support Banner, Interstitial and Video Ad.</description> | ||
<author>Liming Xie</author> | ||
<license>MIT</license> | ||
<keywords>ad,admob,google,play,services,iad,mmedia</keywords> | ||
<repo>https://github.com/floatinghotpot/cordova-mmedia.git</repo> | ||
<issue>https://github.com/floatinghotpot/cordova-mmedia/issues</issue> | ||
|
||
<engines> | ||
<engine name="cordova" version=">=3.5" /> | ||
</engines> | ||
|
||
<js-module src="www/mMedia.js" name="mMedia"> | ||
<clobbers target="window.mMedia" /> | ||
</js-module> | ||
|
||
<!-- android --> | ||
<platform name="android"> | ||
<dependency id="com.google.playservices" version=">=19.0.0"/> | ||
<config-file target="res/xml/config.xml" parent="/*"> | ||
<feature name="mMedia"> | ||
<param name="android-package" value="com.rjfun.cordova.mmedia.mMedia"/> | ||
</feature> | ||
</config-file> | ||
<config-file target="AndroidManifest.xml" parent="/manifest/application"> | ||
<activity android:name="com.millennialmedia.android.MMActivity" | ||
android:theme="@android:style/Theme.Translucent.NoTitleBar" | ||
android:configChanges="keyboardHidden|orientation|keyboard" ></activity> | ||
</config-file> | ||
<config-file target="AndroidManifest.xml" parent="/*"> | ||
<uses-permission android:name="android.permission.RECORD_AUDIO" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-feature android:name="android.hardware.microphone" android:required="false" /> | ||
</config-file> | ||
|
||
<source-file src="src/android/cordova-mmedia.jar" target-dir="libs" /> | ||
|
||
<source-file src="src/android/MMSDK.jar" target-dir="libs" /> | ||
<source-file src="src/android/nmdp_speech_kit.jar" target-dir="libs" /> | ||
<source-file src="src/android/armeabi/libnmsp_speex.so" target-dir="libs/armeabi" /> | ||
|
||
</platform> | ||
|
||
<!-- ios --> | ||
<platform name="ios"> | ||
<config-file target="config.xml" parent="/*"> | ||
<feature name="mMedia"> | ||
<param name="ios-package" value="CDVMMedia" /> | ||
</feature> | ||
</config-file> | ||
<header-file src="src/ios/CDVMMedia.h" /> | ||
<source-file src="src/ios/CDVMMedia.m" /> | ||
<header-file src="src/ios/MMediaAds.h" /> | ||
<source-file src="src/ios/libmMediaAds.a" framework="true" /> | ||
|
||
<framework src="src/ios/MillennialMedia.framework" custom="true"/> | ||
<framework src="src/ios/SpeechKit.framework" custom="true"/> | ||
|
||
<framework src="AdSupport.framework"/> | ||
<framework src="AudioToolbox.framework"/> | ||
<framework src="AVFoundation.framework"/> | ||
<framework src="CFNetwork.framework"/> | ||
<framework src="CoreGraphics.framework"/> | ||
<framework src="CoreLocation.framework"/> | ||
<framework src="EventKit.framework"/> | ||
<framework src="Foundation.framework"/> | ||
<framework src="MediaPlayer.framework"/> | ||
<framework src="MobileCoreServices.framework"/> | ||
<framework src="PassKit.framework"/> | ||
<framework src="QuartzCore.framework"/> | ||
<framework src="Security.framework"/> | ||
<framework src="Social.framework"/> | ||
<framework src="StoreKit.framework"/> | ||
<framework src="SystemConfiguration.framework"/> | ||
<framework src="UIKit.framework"/> | ||
</platform> | ||
|
||
</plugin> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#import <Cordova/CDV.h> | ||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
#import "MMediaAds.h" | ||
|
||
#pragma mark MMedia Plugin | ||
|
||
@interface CDVMMedia : CDVPlugin <MMediaEventDelegate> { | ||
} | ||
|
||
- (void) setOptions:(CDVInvokedUrlCommand *)command; | ||
|
||
- (void)createBanner:(CDVInvokedUrlCommand *)command; | ||
- (void)showBanner:(CDVInvokedUrlCommand *)command; | ||
- (void)showBannerAtXY:(CDVInvokedUrlCommand *)command; | ||
- (void)hideBanner:(CDVInvokedUrlCommand *)command; | ||
- (void)removeBanner:(CDVInvokedUrlCommand *)command; | ||
|
||
- (void)prepareInterstitial:(CDVInvokedUrlCommand *)command; | ||
- (void)showInterstitial:(CDVInvokedUrlCommand *)command; | ||
|
||
@end |
Oops, something went wrong.