Skip to content

Commit

Permalink
Release: version 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Blubaugh and Nathan Shayefar committed Dec 8, 2014
1 parent 3a5f76e commit b3f695f
Show file tree
Hide file tree
Showing 217 changed files with 9,732 additions and 6,294 deletions.
Empty file removed .gitmodules
Empty file.
173 changes: 90 additions & 83 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ Integration instructions are available on the [wiki](https://github.com/mopub/mo

Please view the [changelog](https://github.com/mopub/mopub-android-sdk/blob/master/CHANGELOG.md) for details.

- **Bug Fixes**
- **MRAID 2.0 Support** - The MoPub SDK is now compliant with the MRAID 2.0 specification to enable rich media ads in banners and interstitial ad units. Learn more about MRAID from the [IAB](http://www.iab.net/MRAID#MRAID).
- **Location Polling Updates** - Changed the interaction between application- and device-provided location data: more recent location data is now always used (in the past, application-provided location data was always preferred).

As before, you may still disable MoPub SDK's location polling by calling `MoPub.setLocationAwareness(LocationAwareness.DISABLED)`.
- **Updated Chartboost SDK** Updated the `ChartboostInterstitial` custom event to support Chartboost SDK 5.0.4

## Requirements

Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:0.12.1+'
classpath 'org.robolectric:robolectric-gradle-plugin:0.12.+'
classpath 'com.android.tools.build:gradle:0.14.2+'
}
}

task wrapper(type: Wrapper) {
gradleVersion = '1.12'
gradleVersion = '2.1'
}
77 changes: 37 additions & 40 deletions extras/src/com/mopub/mobileads/ChartboostInterstitial.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
import android.app.Activity;
import android.content.Context;
import android.util.Log;

import com.chartboost.sdk.Chartboost;
import com.chartboost.sdk.ChartboostDelegate;
import com.mopub.common.VisibleForTesting;

import java.util.HashMap;
import java.util.Map;

import java.util.*;
import static com.chartboost.sdk.Model.CBError.CBImpressionError;

/*
* Tested with Chartboost SDK 3.1.5.
* Tested with Chartboost SDK 5.0.4.
*/
class ChartboostInterstitial extends CustomEventInterstitial {
/*
Expand Down Expand Up @@ -37,11 +42,6 @@ static SingletonChartboostDelegate getDelegate() {
return SingletonChartboostDelegate.instance;
}

@Deprecated // for test only
public static void resetDelegate() {
SingletonChartboostDelegate.instance = new SingletonChartboostDelegate();
}

/*
* Abstract methods from CustomEventInterstitial
*/
Expand All @@ -53,9 +53,6 @@ protected void loadInterstitial(Context context, CustomEventInterstitialListener
return;
}

Activity activity = (Activity) context;
Chartboost chartboost = Chartboost.sharedChartboost();

if (extrasAreValid(serverExtras)) {
setAppId(serverExtras.get(APP_ID_KEY));
setAppSignature(serverExtras.get(APP_SIGNATURE_KEY));
Expand All @@ -68,23 +65,29 @@ protected void loadInterstitial(Context context, CustomEventInterstitialListener
return;
}

Activity activity = (Activity) context;
Chartboost.startWithAppId(activity, appId, appSignature);

if (getDelegate().hasLocation(location) &&
getDelegate().getListener(location) != interstitialListener) {
interstitialListener.onInterstitialFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
return;
}

getDelegate().registerListener(location, interstitialListener);
chartboost.onCreate(activity, appId, appSignature, getDelegate());
chartboost.onStart(activity);

chartboost.cacheInterstitial(location);
Chartboost.setDelegate(getDelegate());
Chartboost.setAutoCacheAds(false);
Chartboost.setShouldRequestInterstitialsInFirstSession(true);
Chartboost.setShouldDisplayLoadingViewForMoreApps(false);
Chartboost.onCreate(activity);
Chartboost.onStart(activity);
Chartboost.cacheInterstitial(location);
}

@Override
protected void showInterstitial() {
Log.d("MoPub", "Showing Chartboost interstitial ad.");
Chartboost.sharedChartboost().showInterstitial(location);
Chartboost.showInterstitial(location);
}

@Override
Expand All @@ -108,7 +111,8 @@ private boolean extrasAreValid(Map<String, String> serverExtras) {
return serverExtras.containsKey(APP_ID_KEY) && serverExtras.containsKey(APP_SIGNATURE_KEY);
}

private static class SingletonChartboostDelegate implements ChartboostDelegate {
@VisibleForTesting
static class SingletonChartboostDelegate extends ChartboostDelegate {
private static final CustomEventInterstitialListener NULL_LISTENER = new CustomEventInterstitialListener() {
@Override public void onInterstitialLoaded() { }
@Override public void onInterstitialFailed(MoPubErrorCode errorCode) { }
Expand Down Expand Up @@ -146,20 +150,15 @@ public boolean shouldRequestInterstitial(String location) {
return true;
}

@Override
public boolean shouldRequestInterstitialsInFirstSession() {
return true;
}

@Override
public void didCacheInterstitial(String location) {
Log.d("MoPub", "Chartboost interstitial loaded successfully.");
getListener(location).onInterstitialLoaded();
}

@Override
public void didFailToLoadInterstitial(String location) {
Log.d("MoPub", "Chartboost interstitial ad failed to load.");
public void didFailToLoadInterstitial(String location, CBImpressionError error) {
Log.d("MoPub", "Chartboost interstitial ad failed to load. Error: " + error.name());
getListener(location).onInterstitialFailed(MoPubErrorCode.NETWORK_NO_FILL);
}

Expand All @@ -181,7 +180,7 @@ public void didClickInterstitial(String location) {
}

@Override
public void didShowInterstitial(String location) {
public void didDisplayInterstitial(String location) {
Log.d("MoPub", "Chartboost interstitial ad shown.");
getListener(location).onInterstitialShown();
}
Expand All @@ -190,47 +189,45 @@ public void didShowInterstitial(String location) {
* More Apps delegate methods
*/
@Override
public boolean shouldDisplayLoadingViewForMoreApps() {
public boolean shouldRequestMoreApps(String location) {
return false;
}

@Override
public boolean shouldRequestMoreApps() {
public boolean shouldDisplayMoreApps(String location) {
return false;
}

@Override
public boolean shouldDisplayMoreApps() {
return false;
public void didFailToLoadMoreApps(String location, CBImpressionError error) {
}

@Override
public void didFailToLoadMoreApps() {
public void didCacheMoreApps(String location) {
}

@Override
public void didCacheMoreApps() {
public void didDismissMoreApps(String location) {
}

@Override
public void didDismissMoreApps() {
public void didCloseMoreApps(String location) {
}

@Override
public void didCloseMoreApps() {
}

@Override
public void didClickMoreApps() {
}

@Override
public void didShowMoreApps() {
public void didClickMoreApps(String location) {
}

CustomEventInterstitialListener getListener(String location) {
CustomEventInterstitialListener listener = listenerForLocation.get(location);
return listener != null ? listener : NULL_LISTENER;
}
}

@VisibleForTesting
@Deprecated
public static void resetDelegate() {
SingletonChartboostDelegate.instance = new SingletonChartboostDelegate();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.mopub.mobileads.CustomEventBanner;
import com.mopub.mobileads.MoPubErrorCode;

import java.util.*;
import java.util.Map;

/*
* Tested with Greystripe SDK 2.4.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.mopub.mobileads.CustomEventInterstitial;
import com.mopub.mobileads.MoPubErrorCode;

import java.util.*;
import java.util.Map;

/*
* Tested with Greystripe SDK 2.4.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.content.Context;

import com.inmobi.commons.InMobi;
import com.inmobi.commons.InMobi.LOG_LEVEL;
import com.inmobi.monetization.IMBanner;
Expand All @@ -12,7 +13,8 @@
import com.mopub.mobileads.CustomEventBanner;
import com.mopub.mobileads.MoPubErrorCode;

import java.util.*;
import java.util.HashMap;
import java.util.Map;

/*
* Tested with InMobi SDK 4.4.1
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 05 14:58:07 PDT 2014
#Tue Nov 18 14:15:01 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip
16 changes: 8 additions & 8 deletions mopub-sample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mopub.simpleadsdemo"
android:versionCode="18"
android:versionName="3.2.2">
android:versionCode="19"
android:versionName="3.3.0">
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="19"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


<!-- For MRAID 2 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="com.mopub.simpleadsdemo.MoPubSampleActivity"
android:label="@string/app_name"
android:configChanges="orientation">
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation"/>
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation"/>
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation"/>
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation"/>
android:configChanges="keyboardHidden|orientation|screenSize"/>

<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

</application>

</manifest>
15 changes: 13 additions & 2 deletions mopub-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,26 @@ description = '''MoPub SDK'''

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
buildToolsVersion '21.1.1'

defaultConfig {
versionCode 1
versionName "3.2.1"
versionName "3.3.0"
minSdkVersion 9
targetSdkVersion 19
}

buildTypes {
release {
minifyEnabled true
proguardFiles = [getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg']
}
debug {
minifyEnabled true
proguardFiles = [getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg']
}
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
Expand Down
2 changes: 1 addition & 1 deletion mopub-sample/proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# Support for Android Advertiser ID.
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {*;}

-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {*;}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import android.widget.TextView;

import com.mopub.nativeads.MoPubNativeAdLoadedListener;
import com.mopub.nativeads.MoPubNativeAdPositioning;
import com.mopub.nativeads.MoPubNativeAdRenderer;
import com.mopub.nativeads.MoPubStreamAdPlacer;
import com.mopub.nativeads.RequestParameters;
Expand Down Expand Up @@ -69,12 +68,9 @@ public void onClick(View view) {
views.mDescriptionView.setText(mAdConfiguration.getDescription());
views.mAdUnitIdView.setText(adUnitId);
mViewPager = (ViewPager) view.findViewById(R.id.gallery_pager);
mStreamAdPlacer = new MoPubStreamAdPlacer(getActivity(),
MoPubNativeAdPositioning.clientPositioning()
.addFixedPosition(4)
.addFixedPosition(1)
.enableRepeatingPositions(3)
);

// This ad placer is used to automatically insert ads into the ViewPager.
mStreamAdPlacer = new MoPubStreamAdPlacer(getActivity());
final MoPubNativeAdRenderer adRenderer = new MoPubNativeAdRenderer(
new ViewBinder.Builder(R.layout.native_ad_list_item)
.titleId(R.id.native_title)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import android.widget.ListView;

import com.mopub.nativeads.MoPubAdAdapter;
import com.mopub.nativeads.MoPubNativeAdPositioning;
import com.mopub.nativeads.MoPubNativeAdRenderer;
import com.mopub.nativeads.RequestParameters;
import com.mopub.nativeads.ViewBinder;
Expand Down Expand Up @@ -69,12 +68,9 @@ public void onClick(View view) {
adapter.add("Item " + i);
}

// Create an ad adapter with ads in positions 0, 4, and every 10 places thereafter.
// Create an ad adapter that gets its positioning information from the MoPub Ad Server.
// This adapter will be used in place of the original adapter for the ListView.
mAdAdapter = new MoPubAdAdapter(getActivity(), adapter, MoPubNativeAdPositioning.clientPositioning()
.addFixedPosition(0)
.addFixedPosition(4)
.enableRepeatingPositions(10));
mAdAdapter = new MoPubAdAdapter(getActivity(), adapter);

// Set up an renderer that knows how to put ad data in an ad view.
final MoPubNativeAdRenderer adRenderer = new MoPubNativeAdRenderer(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shadows=com.mopub.nativeads.test.support.MoPubShadowDisplay,com.mopub.nativeads.test.support.MoPubShadowBitmap
Loading

0 comments on commit b3f695f

Please sign in to comment.