Skip to content

Commit

Permalink
Version 3.8.0 of the Google Mobile Ads Unity plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rampara committed Oct 23, 2017
1 parent 99d06c9 commit 96fc4dc
Show file tree
Hide file tree
Showing 72 changed files with 1,094 additions and 73 deletions.
18 changes: 17 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
Google Mobile Ads Unity Plugin Change Log

*************
Version 3.7.10
Version 3.8.0
*************

- Added support for Vungle mediation extras.
- Updated ad views to render within safe area on iOS 11 when using predefined
AdPosition constants.
- Added MediationAdapterClassName() method to all ad formats.
- Fixed issue where ad views are always rendered on the top of the screen for
certain devices.

Built and tested with:
- Google Play services 11.4.0
- Google Mobile Ads iOS SDK 7.24.1
- Unity Jar Resolver 1.2.59.0

*************
Version 3.7.1
*************

- Fix issue where banner and Native Express ads fail to show after being hidden.
Expand Down
93 changes: 93 additions & 0 deletions mediation/Vungle/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
/*
* Gradle file to build a Unity package to add Vungle mediation support to the Google Mobile Ads Unity plugin.
* Usage: ./gradlew exportPackage
*/

defaultTasks 'exportPackage'

// Project level variables.
project.ext {
unity_exe = System.getProperty("UNITY_EXE")
if (unity_exe == null || unity_exe.isEmpty()) {
unity_exe = System.getenv("UNITY_EXE")
}
if (unity_exe == null || unity_exe.isEmpty()) {
unity_exe = '/Applications/Unity/Unity.app/Contents/MacOS/Unity'
}

if (!file(unity_exe).exists()) {
throw new GradleException('Unable to locate installation of Unity. Please create a' +
'UNITY_EXE environment variable and point it to your Unity installation.')
}

pluginSource = file('source/plugin').absolutePath
pluginBuildDir = file('temp/plugin-build-dir').absolutePath
buildPath = file('temp').absolutePath
exportPath = file('GoogleMobileAdsVungleMediation.unitypackage').absolutePath
}

// Build jar from android plugin source files using existing Gradle build file.
task buildAndroidPluginJar(type: GradleBuild) {
buildFile = 'source/android-library/app/build.gradle'
tasks = ['build']
}

// Move android plugin jar to temporary build directory.
task copyAndroidLibraryJar(type: Copy) {
from("source/android-library/app/build/intermediates/bundles/release/")
into("${pluginBuildDir}/Assets/Plugins/Android/")
include('classes.jar')
rename('classes.jar', 'vungle-extras-library.jar')
}

// Copy Unity mediation extras interface to temporary build directory.
task copyExtrasInterface(type: Copy) {
from("../../source/plugin/Assets/GoogleMobileAds/Api/Mediation/")
into("${pluginBuildDir}/Assets/GoogleMobileAds/Api/Mediation/")
include('MediationExtras.cs')
}

copyAndroidLibraryJar.dependsOn(buildAndroidPluginJar)

// Build unity package using through command line interface.
// Create new unity project with files in temporary build directory and export files to a unity package.
// Command line usage and arguments documented at http://docs.unity3d.com/Manual/CommandLineArguments.html.
task exportPackage(type: Exec) {
description = "Creates and exports the Plugin unity package"
executable "${unity_exe}"
args "-g.building",
"-batchmode",
"-projectPath", "${pluginBuildDir}",
"-logFile", "temp/unity.log",
"-exportPackage",
"Assets/GoogleMobileAds/Api/Mediation/Vungle",
"Assets/GoogleMobileAds/Editor",
"Assets/Plugins",
"${exportPath}",
"-quit"

ignoreExitValue true

doLast {
if (execResult.getExitValue() != 0) {
copy {
from "temp/"
into "./"
include "unity.log"
}
}
}
}

task createTempBuildFolder(type: Copy) {
from { "${pluginSource}" }
into { "${pluginBuildDir}" }
}

task clearTempBuildFolder(type: Delete) {
delete { "${buildPath}" }
}

exportPackage.dependsOn(createTempBuildFolder, copyAndroidLibraryJar, copyExtrasInterface)
exportPackage.finalizedBy(clearTempBuildFolder)
6 changes: 6 additions & 0 deletions mediation/Vungle/source/android-library/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
1 change: 1 addition & 0 deletions mediation/Vungle/source/android-library/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
56 changes: 56 additions & 0 deletions mediation/Vungle/source/android-library/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26
buildToolsVersion "22.0.1"

defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
abortOnError false
}
}

dependencies {
compile files('libs/unity-plugin-library.jar')
compile 'com.google.ads.mediation:vungle:5.1.0.0'
}

// Build jar from android plugin source files using existing Gradle build file.
task buildAndroidPluginJar(type: GradleBuild) {
buildFile = '../../../../../source/android-library/app/build.gradle'
tasks = ['build']
}

// Move android plugin jar to libs directory.
task copyAndroidLibraryJar(type: Copy) {
from("../../../../../source/android-library/app/build/intermediates/bundles/release/")
into("libs")
include('classes.jar')
rename('classes.jar', 'unity-plugin-library.jar')
}

task clearJar(type: Delete) {
delete 'build/libs/vungle-extras-library.jar'
}

task makeJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('build/libs/')
include('classes.jar')
rename('classes.jar', 'vungle-extras-library.jar')
}

makeJar.dependsOn(clearJar, build)
preBuild.dependsOn(copyAndroidLibraryJar, buildAndroidPluginJar)
17 changes: 17 additions & 0 deletions mediation/Vungle/source/android-library/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/rampara/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.unity.mediation.vungle">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.google.unity.mediation.vungle;

import android.os.Bundle;

import com.google.unity.ads.AdNetworkExtras;
import com.vungle.mediation.VungleExtrasBuilder;

import java.util.HashMap;

/**
* Mediation extras bundle class for the Vungle adapter.
*/
abstract class VungleUnityExtrasBuilder implements AdNetworkExtras {

/**
* Key to add and obtain all placements.
*/
private static final String ALL_PLACEMENTS_KEY = "all_placements";

private static final String USER_ID_KEY = "user_id";

private static final String SOUND_ENABLED_KEY = "sound_enabled";

@Override
public Bundle buildExtras(HashMap<String, String> extras) {
String placements = extras.get(ALL_PLACEMENTS_KEY);
if (placements == null) {
return null;
}

VungleExtrasBuilder extrasBuilder =
new VungleExtrasBuilder(extras.get(ALL_PLACEMENTS_KEY).split(","));


String soundEnabled = extras.get(SOUND_ENABLED_KEY);
if (soundEnabled != null) {
extrasBuilder.setSoundEnabled(Boolean.valueOf(soundEnabled));
}

String userId = extras.get(USER_ID_KEY);
if (userId != null) {
extrasBuilder.setUserId(userId);
}

return extrasBuilder.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.google.unity.mediation.vungle;

import com.vungle.mediation.VungleInterstitialAdapter;

/**
* Mediation extras bundle class for the Vungle adapter.
*/
public class VungleUnityInterstitialExtrasBuilder extends VungleUnityExtrasBuilder {

@Override
public Class getAdapterClass() {
return VungleInterstitialAdapter.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.google.unity.mediation.vungle;

import com.vungle.mediation.VungleAdapter;

/**
* Mediation extras bundle class for the Vungle adapter.
*/
public class VungleUnityRewardedVideoExtrasBuilder extends VungleUnityExtrasBuilder {

@Override
public Class getAdapterClass() {
return VungleAdapter.class;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<resources>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<resources>
</resources>
25 changes: 25 additions & 0 deletions mediation/Vungle/source/android-library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
flatDir {
dirs 'libs'
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Jul 12 16:58:21 PDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.1-bin.zip
Loading

0 comments on commit 96fc4dc

Please sign in to comment.