├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ ├── LICENSE.md │ ├── LICENSE.txt │ ├── core-1.1.0.jar │ ├── gson-2.8.6.jar │ ├── localbroadcastmanager-1.0.0.jar │ ├── okhttp-3.14.9.jar │ ├── okio-1.17.3.jar │ ├── vungle-android-sdk-6.12.1.aar │ └── vungle-android-sdk-6.12.1.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── publisher │ │ └── sample │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── publisher │ │ │ └── sample │ │ │ ├── BannerListActivity.java │ │ │ ├── BannerMultipleActivity.java │ │ │ ├── ItemHolder.java │ │ │ ├── MainActivity.java │ │ │ └── VungleBannerAdAdapter.java │ └── res │ │ ├── drawable │ │ ├── aqua_button_bg.xml │ │ ├── aqua_button_normal.xml │ │ ├── aqua_button_pressed.xml │ │ ├── ic_launcher_background.xml │ │ ├── v_expression_splash.png │ │ ├── vungle_logo_aqua_mango.png │ │ └── vungle_logo_aqua_mango_banner.png │ │ ├── layout │ │ ├── activity_banner_list.xml │ │ ├── activity_banner_multiple.xml │ │ ├── activity_main.xml │ │ ├── ad_item.xml │ │ └── rv_item.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── network_security_config.xml │ └── test │ └── java │ └── com │ └── publisher │ └── sample │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── simpleapp ├── .gitignore ├── build.gradle ├── libs ├── LICENSE.md ├── LICENSE.txt ├── core-1.1.0.jar ├── gson-2.8.6.jar ├── localbroadcastmanager-1.0.0.jar ├── okhttp-3.14.9.jar ├── okio-1.17.3.jar ├── vungle-android-sdk-6.12.1.aar └── vungle-android-sdk-6.12.1.jar ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── publisher │ └── simpleapp │ └── ExampleInstrumentedTest.java ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── publisher │ │ └── simpleapp │ │ └── MainActivity.java └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ └── network_security_config.xml └── test └── java └── com └── publisher └── simpleapp └── ExampleUnitTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Android 4 | gen/ 5 | # Built application files 6 | *.apk 7 | *.ap_ 8 | # Files for the ART/Dalvik VM 9 | *.dex 10 | 11 | # Android Studio 12 | .idea/ 13 | gen-external-apklibs/ 14 | *.iml 15 | 16 | # Eclipse 17 | .apt_generated/ 18 | .settings/ 19 | .classpath 20 | .factorypath 21 | .project 22 | 23 | # Local configuration file (sdk path, etc) 24 | local.properties 25 | project.properties 26 | /AndroidManifest.xml 27 | # Generated files 28 | bin/ 29 | out/ 30 | 31 | # Gradle files 32 | .gradle/ 33 | build/ 34 | 35 | # Java class files 36 | *.class 37 | 38 | # MacOS 39 | .DS_Store 40 | 41 | # Maven 42 | target/ 43 | 44 | # Proguard folder generated by Eclipse 45 | proguard/ 46 | 47 | # Log Files 48 | *.log 49 | 50 | # Android Studio Navigation editor temp files 51 | .navigation/ 52 | 53 | # Android Studio captures folder 54 | captures/ 55 | 56 | # Keystore files 57 | *.jks 58 | 59 | /.idea/workspace.xml 60 | /.idea/libraries 61 | .DS_Store 62 | /build 63 | /captures 64 | .externalNativeBuild 65 | 66 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog 2 | 3 | ### VERSION 6.12.1 (January 10, 2023) 4 | * SDK now supports Android [Target API 33](https://developer.android.com/sdk/api_diff/33/changes) 5 | * In-app bidding enhancements 6 | * Performance optimizations & bug fixes 7 | 8 | ### VERSION 6.12.0 (August 2, 2022) 9 | * New ad format: Rewarded Interstitial (closed beta) 10 | * In-app bidding enhancements 11 | * Performance optimizations & bug fixes 12 | 13 | ### VERSION 6.11.0 (May 3, 2022) 14 | * Added support for Native Ads format for non-HB placements (closed beta) 15 | * In-app bidding enhancements 16 | * Support of deep-linking URLs into other apps 17 | 18 | ### VERSION 6.10.5 (March 10, 2022) 19 | * Fixed a random crash owing to a synchronization issue around handling Gson lib JsonObject. 20 | 21 | ### VERSION 6.10.4 (February 9, 2022) 22 | * Updated SDK to be fully compliant with [Google Privacy Policies](https://developer.android.com/about/versions/12). 23 | * COPPA API is now generally available. 24 | * Stability Improvements. 25 | 26 | ### VERSION 6.10.3 (December 9, 2021) 27 | * Added support for Google’s [Android 12](https://developer.android.com/about/versions/12). 28 | * SDK now supports Android [Target API 31](https://developer.android.com/sdk/api_diff/31/changes). 29 | * Added the framework for COPPA API, which can be used as an additional tool to assist publishers with obligations under COPPA. This API is in Beta release, and behavior might change in future versions of SDK. 30 | 31 | ### VERSION 6.10.2 (September 1, 2021) 32 | * Fixed low occurring `ConcurrentModificationException` crash 33 | 34 | ### VERSION 6.10.1 (August 5, 2021) 35 | * Moved to mavenCentral repository 36 | * SDK artifacts for gradle integration now distributed through mavenCentral, using the same maven artifactID 37 | * Increased minimum supported API level to 21 38 | * Addition of creativeId event to PlayAdCallback 39 | * Stability improvements 40 | #### Mediation In-App Bidding (Closed Beta) 41 | * Banner / MREC Bidding Support in Bidding 42 | * Caching enhancements for in-app bidding Placements 43 | * New SDK APIs for in-app bidding (only applicable to mediation partners) 44 | 45 | ### VERSION 6.9.1 (January 21, 2021) 46 | * OM SDK Integration - The Open Measurement Software Development Kit (OM SDK) is designed to facilitate third-party viewability and verification measurement for ads served by Vungle 47 | * Stability improvements 48 | 49 | ### VERSION 6.8.1 (October 14, 2020) 50 | * onAdViewed - new callback introduced to more accurately track ad impressions 51 | * Stability improvements 52 | 53 | ### VERSION 6.8.0 (September 15, 2020) 54 | * Android 11 Support (Since 6.7.1) 55 | * Removed Flex Feed and Flex View formats 56 | * Stability improvements 57 | 58 | ### VERSION 6.7.1 (August 17, 2020) 59 | * Support for Android 11 60 | * Explicitly enabled WebSettings.setAllowFileAccess to improve video rendering in WebView 61 | * Improvements to handling Intent.resolveActivity that could fail requiring new Android 11 permissions that could affect click of ads 62 | * Gson updated to 2.8.6 63 | * Okhttp updated to 3.12.12 64 | * Logging-interceptor no longer required 65 | * Various bug fixes 66 | 67 | ### VERSION 6.7.0 (June 22, 2020) 68 | * CCPA Support – Compliance with new government regulations while assuring your users their personal data is being used the way they want 69 | * Multiple banner ad support – Display multiple banners on the screen to leverage more ways to monetize your inventory and attract Premium Buyers 70 | * Upgrade moat v2.6.3 – To enhance your analytics and improve strategic decisions based on data 71 | * Improved real-time ad play callbacks for click and rewarded events for a better end-user experience 72 | * Removed Retrofit library to now use GSON 2.8. 73 | * Backend performance improvements to continually optimize your monetization efforts 74 | * Various bug fixes 75 | 76 | ### VERSION 6.5.3 (March 24, 2020) 77 | * Bugs and issues resolved 78 | 79 | ### VERSION 6.5.2 (February 14, 2020) 80 | * Programmatic Demand Banner Support 81 | * Bug Fixes 82 | 83 | ### VERSION 6.5.1 (January 30, 2020) 84 | * Included new Target API 29 (Android 10) and AndroidX support (including dependencies based on AndroidX ) 85 | * Optimized caching again to reduce data usage 86 | * Added addition support for new banner sizes (320x50, 300x50, 728x90) 87 | * MOAT viewability tracking fix 88 | * Improved ad playback on Android 7 and below 89 | * Fixed memory leaks 90 | * Made background webview of banner transparent 91 | * Added annotations to lower size of SDK using Proguard 92 | * Improved how our SDK handles orientation settings and changes 93 | * Various bugs squashed and stability improvements 94 | 95 | ### VERSION 6.5.0 96 | * Android 10 support and build for API 29 97 | * AndroidX support 98 | * Introduction of Banner Format 99 | * Continuous improvements to ad caching 100 | * Fixed an issue with Moat tracker 101 | * Critical bug-fixes 102 | 103 | ### VERSION 6.4.11 104 | * Cache Optimization — Automatically optimizes ad caching to ensure ads are available faster. No additional work from developer needed 105 | * Introduced new MREC Video placement type to serve higher performing banners 106 | * Privacy by Design — Removed latitude and longitude collection to protect users 107 | * Updated Moat to no longer collect location data 108 | * Removed Fetch library dependency 109 | * Publisher controls to override minimum disk requirements, helping to ensure good user experiences 110 | 111 | ### VERSION 6.3.24 112 | * Android 9 Pie is now supported 113 | * Lighter SDK with a lower method count and fewer external 3rd party dependencies 114 | * Programmatic ad performance has been improved to address stability issues 115 | * Improvements in runtime memory usage by SDK 116 | * Custom Creative performance improvements 117 | 118 | ### VERSION 6.3.17 119 | * Updates for improved performance 120 | 121 | ### VERSION 6.3.12 122 | * Optional placement list during initialization, support for zero auto-cached Placement 123 | * Removal of Evernote and related transitive dependencies 124 | * Stability fixes 125 | 126 | ### VERSION 6.2.5 127 | * GDPR compliance 128 | * License update 129 | * Redesigned SDK to lower method count and SDK size 130 | * Reduced time needed to initialize and play a cached Ad 131 | * Deprecated generic callback and introduced API specific callbacks to simplify integration. Please refer Migration section of V6 SDK documentation 132 | 133 | ### VERSION 5.3.2 134 | * Sleep code to be enforced at placement level 135 | * Ability to close Flex-View ads through API and timer 136 | * Ordinal data reporting 137 | * Bug fixes and performance improvements 138 | 139 | ### VERSION 5.3.0 140 | * Added support for Amazon appstore/platform and Amazon Advertising ID 141 | * Android Oreo compatibility. 142 | * Ability to detect and target Apps for ‘Allow unknown sources’ on devices 143 | to enable sideload of apk's 144 | * Bug-fixes for Stability 145 | 146 | ### VERSION 5.1.0 147 | * Launched new Placements feature. 148 | * Added Native Flex View ad unit. 149 | * Added Moat Viewability technology to provide viewership data on ads. 150 | 151 | ### VERSION 4.0.3 152 | * Added support for Android Nougat (Android v7.0) 153 | * Reporting more device stats to serve better and better ads 154 | * Upgraded to Dagger 2.7 155 | * Added wrapper-framework values for admob, dfp, heyzap, mopub 156 | * Integrated RxJava architecture for ad preparation 157 | 158 | ### VERSION 4.0.2 159 | * Fixed the device ID timeout when play-services is not included 160 | * Migrate to Dagger 2 161 | * Cleaned up all the Proguard filters that are not required after Dagger 2 migration 162 | * Fixed a few minor Unity bugs 163 | * Handling SSL errors better 164 | * Developers are warned when invalid App ID is used to initialize 165 | * Added support for interstitial MRAID ads 166 | * Updated `EventListener.onAdEnd()` api to include wasSuccessfulView parameter 167 | * Deprecated `EventListener.onVideoView()` api 168 | * Increased min Android API level to 3.0 (Honeycomb - version 11) 169 | * Removed dependency on support-v4 library and nineoldandroids library 170 | 171 | ### VERSION 3.3.5 172 | * Added support for Dagger 2 173 | * Increased minimum supported Android SDK level from API 9 to API 11 174 | * Upgraded maximum Google Play Services version to 8.3.0 175 | * Removed dependencies on support-v4 library and nineoldandroids library 176 | * Fixed black screen issue with Unity plugin 177 | 178 | ### VERSION 3.3.4 179 | * Fixed a bug that might cause a crash on devices with Android 4.2 or lower OS 180 | * Fixed a bug to resume the video ad upon unlocking the screen on devices with screenlock set to none 181 | * Persist sleeps across app restarts 182 | 183 | ### VERSION 3.3.3 184 | * Added support for Android Marshmallow by simplifying the required app permissions 185 | 186 | ### VERSION 3.3.2 187 | * Fixed a bug that might cause ad to crash when returning to foreground 188 | 189 | ### VERSION 3.3.1 190 | 191 | * Improved event bus performance 192 | * Added support for remote error reporting 193 | * Added support for installed app data collection 194 | * Updated incentivized dialogs to use the default application theme 195 | * Added link to Vungle's privacy policy in the ad experience 196 | * Replaced the countdown timer with a progress bar timer 197 | * Fixed some minor bugs 198 | 199 | ### VERSION 3.3.0 200 | 201 | * Added support for latest Google Play Services (6.5.87+) 202 | * The Vungle SDK can now be integrated without Google Play Services if desired 203 | * Changed the `VunglePub` public API 204 | * Added support for multiple EventListeners 205 | * Renamed `setEventListener()` to `setEventListeners()` 206 | * Added `addEventListeners()`, `clearEventListeners()`, and `removeEventListeners()` 207 | * Renamed `isCachedAdAvailable()` to `isAdPlayable()` 208 | * Renamed `EventListener.onCachedAdAvailable()` to `EventListener.onAdPlayableChanged()` 209 | * `VunglePub.isAdPlayable()` and `EventListener.onAdPlayableChanged()` take into account minimum mdelays between ads and other conditions which might prevent an ad from being played if requested. Previously, `VunglePub.isCachedAdAvailable()` and `EventListener.onCachedAdAvailable()` did not take these factors into account. 210 | * Ad close now enabled during and after incentivized alert dialog 211 | * Improved local caching performance 212 | * Improved cached ad retrieval logic and timing 213 | * Improved network request handling 214 | * Improved notifications around failed network requests 215 | * Improved logic and timing of queued network requests 216 | 217 | ### VERSION 3.2.2 218 | 219 | * new 'adaptiveId' that uses [Android Advertising ID](https://developer.android.com/google/play-services/id.html) for attribution if available, otherwise falls back to [Android ID](http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID) and wifi MAC address (if available) 220 | * fixed a bug with extra `EventListener.onAdEnd()` notifications 221 | 222 | ### VERSION 3.2.1 223 | 224 | * fixed Vungle `User-Agent` for requests to Vungle servers 225 | * use browser `User-Agent` for requests to non-Vungle servers 226 | * prevented video exit buttons from being clicked multiple times 227 | * fixed ads not playing under certain conditions in `singleTask` `Activity` launch mode 228 | 229 | ### VERSION 3.2.0 230 | 231 | * changes to maintain server-determined order for ads 232 | * added `AdConfig.setImmersiveMode()` to enable immersive mode in KitKat+ devices (default is `false`, which is a change from versions 3.1.1 and prior) 233 | * added parameter to callback `EventListener.onAdEnd(boolean wasCallToActionClicked)` to indicate whether the user clicked the call-to-action (usually 'Download') button (breaks backwards compatibility) 234 | * modified `VunglePub.init()` to return a `boolean` indicating whether intialization was successful rather than `void` 235 | * added missing callbacks to `EventListener.onAdUnavailable()` in a few rare circumstances 236 | * unbundled libraries as separate, required jars: `dagger-[version].jar` and `nineoldandroids-[version].jar` 237 | * added Javadoc for `AdConfig` 238 | 239 | ### VERSION 3.1.1 240 | 241 | * added geolocation support in apps with `ACCESS_COARSE_LOCATION` or `ACCESS_FINE_LOCATION` permission 242 | * fixed bug where ads would stop playing until app was restarted 243 | * fixed bug in reporting streaming ads 244 | * fixed bug where some ad progress messages were not being sent 245 | * fixed bug where the ad report of the currently playing ad could be deleted 246 | * reduced delay between `VunglePub.init()` and initial ad request from 3 seconds to 2 seconds 247 | * delete old version 1.x.x cache directory if it exists 248 | * hid some debug logging messages that were being shown in production mode 249 | 250 | ### VERSION 3.1.0 251 | 252 | * added support for [Android Advertising ID](https://developer.android.com/google/play-services/id.html) 253 | * removed references to `android.provider.Settings.Secure.ANDROID_ID` 254 | * added `AdConfig.setPlacement()` for tracking ad performance by placement location 255 | * added `AdConfig.setExtra1-8()` for passing developer-defined key-value pairs 256 | * added 3 second delay between `VunglePub.init()` and initial ad request to allow for global `AdConfig` configuration 257 | * removed deprecated methods `AdConfig.setShowClose()` and `AdConfig.isShowClose()` (please confugre these from the [Vungle Dashboard](https://v.vungle.com)) 258 | * fixed `Activity` and `Fragment` recreation if they are destroyed while in the background 259 | * fixed sound bug with ads starting muted 260 | * fixed bugs affecting session length calculation 261 | * added `logcat` warning messages for missing `AndroidManifest.xml` permissions and config 262 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | Please refer to https://support.vungle.com/hc/en-us/articles/360002922871 3 | 4 | Vungle SDK for Android 5 | ======================= 6 | 7 | **Version 6.12.1** 8 | 9 | Welcome to the Vungle SDK which has been battle-tested to unlock amazing monetization opportunities for you. The Vungle SDK enables the very best creatives in mobile advertising. 10 | 11 | ## Attributions 12 | | Component | Version | Description | License | 13 | |---------------------------------|---------|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| 14 | | Android X (Jetpack) | 1.1.0 | Core and LocalBroadcastManager Android X libraries from Jetpack | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) | 15 | | Google Gson | 2.8.6 | Java library to serialize and deserialize Java objects to JSON | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) | 16 | | OkHttp | 3.14.9 | An HTTP+HTTP/2 client for Android and Java applications | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) | 17 | | Open Measurement (OM) In-App | 1.0 | Measurement of mobile in-app ads by third-party viewability and verification vendors | [Open Measurement (OM) License](https://s3-us-west-2.amazonaws.com/omsdk-files/docs/OMLICENSE.pdf) | 18 | | Open Measurement (OM) Web Video | 1.0 | Web Video supports video ads on desktop and mobile | [Open Measurement (OM) License for Web Video](https://tools.iabtechlab.com/assets/WebLicense.pdf) | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | signingConfigs { 5 | release { 6 | keyAlias 'MyAndroidKey' 7 | keyPassword 'myKeyPassword' 8 | storeFile file('keystores/android.jks') 9 | storePassword 'myStorePassword' 10 | } 11 | } 12 | 13 | compileSdkVersion 33 14 | buildToolsVersion '30.0.3' 15 | defaultConfig { 16 | applicationId "com.publisher.vungle.sample" 17 | minSdkVersion 21 18 | targetSdkVersion 31 19 | versionCode 1 20 | versionName "1.0" 21 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 22 | } 23 | android { 24 | compileOptions { 25 | sourceCompatibility JavaVersion.VERSION_1_8 26 | targetCompatibility JavaVersion.VERSION_1_8 27 | } 28 | } 29 | buildTypes { 30 | debug { 31 | minifyEnabled false 32 | shrinkResources false 33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 34 | } 35 | release { 36 | minifyEnabled true 37 | shrinkResources true 38 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 39 | signingConfig signingConfigs.release 40 | } 41 | } 42 | } 43 | 44 | dependencies { 45 | androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { 46 | exclude group: 'com.android.support', module: 'support-annotations' 47 | }) 48 | 49 | implementation 'androidx.recyclerview:recyclerview:1.2.1' 50 | implementation 'androidx.constraintlayout:constraintlayout:2.1.0' 51 | 52 | // Required AndroidX support libraries 53 | implementation "androidx.core:core:1.1.0" 54 | implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0" 55 | 56 | // When appcompat is being used, core and localbroadcastmanager are the dependencies 57 | // that is getting included 58 | implementation 'androidx.appcompat:appcompat:1.3.0' 59 | 60 | // Vungle SDK 61 | implementation 'com.vungle:publisher-sdk-android:6.12.1' 62 | 63 | // Recommended Google Play Services libraries to support app set ID (v6.10.3 and above) 64 | implementation 'com.google.android.gms:play-services-tasks:18.0.2' 65 | implementation 'com.google.android.gms:play-services-appset:16.0.2' 66 | 67 | // Recommended Google Play Services libraries to support Google Advertising ID 68 | implementation 'com.google.android.gms:play-services-basement:18.1.0' 69 | implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1' 70 | 71 | // AAR Integration 72 | // implementation files('libs/vungle-android-sdk-6.12.1.aar') 73 | // implementation files('libs/gson-2.8.6.jar') 74 | // implementation files('libs/okhttp-3.14.9.jar') 75 | // implementation files('libs/okio-1.17.3.jar') 76 | 77 | // JAR Integration 78 | // implementation files('libs/vungle-android-sdk-6.12.1.jar') 79 | // implementation files('libs/gson-2.8.6.jar') 80 | // implementation files('libs/okhttp-3.14.9.jar') 81 | // implementation files('libs/okio-1.17.3.jar') 82 | } 83 | -------------------------------------------------------------------------------- /app/libs/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Vungle SDK License and Publisher Terms 2 | This Vungle SDK License and Publisher Terms (“Agreement”) is made available by Vungle, Inc. (“Vungle”). By downloading or using the Vungle SDK, you and any company, entity, or organization on behalf of which you are accepting this Agreement (“Developer”) hereby agrees to be bound by all terms and conditions of this Agreement, and you represent and warrant that you are an authorized representative of Developer with the authority to bind Developer to this Agreement. If you do not agree to all terms and conditions of this Agreement, do not download or use the Vungle SDK. 3 | 1. Definitions. 4 | A. “Advertisers” means third-party advertisers. 5 | B. “App Data” means data from the device of an end-user, including, for example, orientation data, volume settings, OS language, device make/model, operating system, mobile carrier, and device identifiers. 6 | C. “Developer Apps” means the mobile applications owned and/or controlled by Developer, including all content, images, music and text contained therein, that Developer wishes to use with the Vungle SDK and Vungle Platform. 7 | D. “Documentation” means all technical documentation provided by Vungle to Developer to support use of the Vungle SDK, including without limitation, user manuals, functional descriptions, help guides, and other materials, as may be updated by Vungle from time to time. 8 | E. “Performance Data” means data regarding advertisement performance, including, for example, impressions, interactions, installs, header information, and end user segments or interests. 9 | F. “Vungle Ads” means video advertisements, sourced by or on behalf of Vungle, which are routed and/or served by the Vungle Platform to the Developer Apps. 10 | G. “Vungle Platform” means Vungle’s hosted video advertising system, which supports video advertisement insertion within mobile applications, and related advertisement reporting tools. 11 | H. “Vungle SDK” means the software development kit, including and solely as enabled by the Documentation, available for download on Vungle’s website as of the Effective Date, and any other software that may be provided by Vungle to Developer with the software development kit, including any updates thereto. 12 | 2. Vungle SDK License. 13 | A. License Grant. Subject to the terms and conditions of this Agreement, Vungle grants Developer a non-exclusive, non-transferable, non-sublicenseable, worldwide license to: (a) integrate the Vungle SDK with Developer Apps solely for internal use; (b) use, reproduce and distribute certain portions of the Vungle SDK as required for Developer’s distribution of Developer Apps; provided that, any distribution to an end user will be subject to terms that protect the Vungle SDK in a manner at least as protective as set forth herein; and (c) use the Vungle SDK and Vungle Platform to have Vungle Ads inserted within Developer Apps pursuant to this Agreement. 14 | B. SDK Updates. Vungle periodically releases new versions of, or updates to, the Vungle SDK which may contain new features and fixes (each a, “SDK Update”). Each SDK Update will be presented to Developer within the Vungle Platform dashboard, and Developer is encouraged to download and integrate each SDK Update within the Developer Apps. Each SDK Update shall be subject to the terms and conditions of this Agreement. Vungle may sunset versions of the Vungle SDK that are older than 24 months. C. License Restrictions. Except as expressly provided in this Agreement, Developer shall not (and shall not allow any third party to): (a) decompile, reverse engineer, disassemble, modify, adapt, create derivative works of, copy or distribute the Vungle SDK or Vungle Platform, (b) modify, remove, or obscure any copyright, trademark, patent or other proprietary notices or legends from the Vungle SDK or Vungle Platform; (c) copy, distribute, rent, lease, lend, sublicense, transfer or make the Vungle SDK or Vungle Platform available to any third party, (d) use the Vungle SDK or Vungle Platform to develop, upload, or transmit any software viruses or other computer code, files or programs designed to interrupt, destroy, or limit the functionality of any software or hardware, or (e) use the Vungle SDK, Vungle Platform, or any data collected, received, or provided access via the Vungle SDK or Vungle Platform, except as expressly set forth in this Agreement, including to re-identify an individual end user. 15 | 3. Intellectual Property. 16 | All ownership rights, title, and interest in and to the Vungle SDK and Vungle Platform, including all intellectual property rights therein, as such may be modified, upgraded, or enhanced from time to time (“Vungle Property”) will remain and belong exclusively to Vungle. Vungle reserves all rights not expressly granted to Developer herein. Developer shall retain all ownership rights, title and interest in and to the Developer Apps, including all intellectual property rights therein, as such may be modified, upgraded or enhanced from time to time. If Developer elects to provide any suggestions, comments, improvements, ideas or other feedback or materials to Vungle (collectively, “Feedback”), Developer hereby grants Vungle the right to freely use, copy, disclose, license, distribute and exploit any such Feedback in any manner without any obligation, royalty or restriction based on intellectual property rights or otherwise. 17 | 4. Advertising via The Vungle Platform. 18 | A. Vungle Insertion  Sale of Ads. Developer hereby grants Vungle the right to sell, and have sold, advertisement inventory in the Developer Apps, and to insert Vungle Ads within such inventory. Developer agrees that in connection with Vungle Ads, Vungle may access or call to the Developer Apps, or the servers that make them available, and cause the routing, transmission, reproduction, and display of Vungle Ads as contemplated herein. Unless expressly agreed in writing, Vungle makes no guarantee that any level or amount of Vungle Ads will be placed in the Developer Apps. In addition, Developer hereby grants Vungle the non-exclusive, worldwide right and license to use, reproduce, distribute and display Developer’s and the Developer Apps’ trademarks, names, logos, and images of the Developer Apps, in connection with the sale of Vungle Ads hereunder, including (a) listing the Developer Apps and inventory in pitch materials to prospective Advertisers; (b) reporting the inclusion of Developer Apps and inventory as part of Vungle’s advertising network, and (c) identifying the Developer as a publishing partner on Vungle’s website and other marketing materials. 19 | B. Developer Apps Content Policy. The Developer Apps will not contain, consist of, or promote discrimination, illegal activities, hate speech, defamation, graphic violence, firearms, tobacco, illegal drugs, pornography, sex-trafficking, profanity, obscenity or sexually explicit material (“Developer Apps Content Policy”). Additionally, Developer will notify Vungle immediately of any Developer Apps relating to alcohol or real-money gambling. Developer agrees that Vungle has no responsibility for the Developer Apps, including any content therein, and Vungle has no obligation or ability to monitor or edit the Developer Apps. Developer will provide as much advance written notice as reasonably practicable, but in no event less than fifteen (15) days’ notice, regarding any material changes to the nature or design of any Developer App, including without limitation, changes to the placement of inventory, any action that will increase or reduce expected inventory within the Developer Apps, the type of content contained within the Developer Apps, or the target audience of the Developer Apps. 20 | C. Ad Restrictions; Invalid Impressions. Developer may not, and may not authorize or encourage any third party to: (i) engage in or create Invalid Impressions; (ii) edit, modify, filter, or change the order of the information contained in any Vungle Ad, or remove, obscure or minimize any Vungle Ad in any way; and/or (iii) redirect an end user away from any web page or app accessed by an end user after selecting or clicking on any part of a Vungle Ad (“Advertiser Page”), provide a version of the Advertiser Page different from the page an end user would access by going directly to the Advertiser Page, or intersperse any content between the Vungle Ads and the Advertiser Page. As used herein, “Invalid Impressions” means any impressions, downloads, installs, views, taps, clicks or other user engagement relating to any Vungle Ad campaign that may artificially inflate an Advertiser's costs or Developer's earnings. By way of example, and without limitation, Invalid Impressions are caused by: (1) repeated manual clicks, (2) using “robots”, “spiders” or other tools for making automated computer generated requests, (3) using offers of cash, prizes, incentives, gift cards, vouchers or anything of value, including cryptocurrency, (4) using a design that encourages or is likely to lead to unintended impressions, downloads, installs, views, taps, clicks or other user actions, (5) manipulating or misrepresenting device IDs, Ad IDs, geolocation or other user or device information; (6) hijacking of an end user’s device; (7) automatic advertisement refreshes; or (8) any other deceptive or fraudulent methods. Developer shall promptly notify Vungle if it suspects that any third party may be tampering with, abusing or manipulating the Vungle Platform or the Vungle Ads within the Developer App, or otherwise violating the restrictions of this Section 4.C. Vungle may suspend Developer’s use of the Vungle Platform and/or terminate this Agreement immediately should Developer violate the foregoing provisions of this Section, or if Vungle observes unusually high levels of impressions, downloads, installs, views, taps or clicks on Developer’s account. Developer shall not be entitled to any revenue associated with Invalid Impressions or campaigns associated with violations of this Section 4.C. 21 | D. Developer Ad Campaigns. In the event that Developer desires to become an Advertiser, and advertise its app within the Vungle network of publishers, the parties will enter into a separate mutually agreed upon insertion order. 22 | 5. Data  Privacy. 23 | A. Collection of Data. Developer acknowledges and agrees that Vungle may: (i) use the Vungle Property to collect and use App Data and Performance Data in connection with the performance of this Agreement, including to display Vungle Ads to end users and to measure and report the performance of Vungle Ads; (ii) disclose App Data and Performance Data (a) to third parties (including Advertisers and attribution partners) as reasonably necessary in connection with the operation of the Vungle Platform and performance of this Agreement, (b) if required by any court order, process, law or governmental agency; or (c) generally, when such data is aggregated, so that the specific information relating to Developer is not identified as such; and (iii) use App Data and Performance Data for Vungle’s internal business purposes, including to develop and improve the Vungle SDK and Vungle Platform, perform internal analytics regarding Vungle SDK performance, and to monitor for errors. Vungle will collect and use the App Data and Performance Data in accordance with Vungle’s Privacy Notice, which is available at http://vungle.com/privacy/ (as updated from time to time). This Section 5.A. shall survive the termination or expiration of this Agreement. 24 | B. Compliance with Privacy Laws. In performance of this Agreement, Developer agrees to comply with all applicable laws, governmental regulations, court or government agency orders, and decrees relating in any manner to the collection, use, or dissemination of data from or about users, user traffic, or otherwise relating to privacy rights, including the Children’s Online Privacy Protection Act (“COPPA”). In addition, Developer agrees to conspicuously post a privacy notice that accurately describes the Developer’s and third parties’ collection, use, and disclosure of end user data from the Developer Apps, which include disclosure (i) that third parties may collect or receive information and use that information to provide measurement services and targeted ads, and (ii) how and where users can opt-out of collection and use of information for ad targeting. Developer will not pass any personally-identifiable information to Vungle unless expressly permitted in writing, and except as permitted under and in compliance with applicable law. Vungle reserves the right to modify, suspend, or terminate this Agreement should Developer violate this Section, and/or to remain compliant with law. 25 | C. Vungle Data Privacy Addendum. As applicable, and to the extent performance of this Agreement entails the collection and/or processing of any data or information from end users in the European Economic Area, the parties agree that the additional terms and conditions set forth in the Vungle Data Privacy Addendum (“DPA”) attached hereto and incorporated herein as Exhibit A apply to this Agreement. To the extent this Agreement conflicts with the DPA, the DPA shall govern and control. 26 | 6. Developer Fees; Payment. 27 | A. Standard Developer Fee. Subject to the terms and conditions of this Agreement, Vungle shall pay to Developer a percentage of the Net Revenue (the “Developer Fee”), as determined by Vungle. “Net Revenue” means the gross revenue actually collected by Vungle from Advertisers for Vungle Ads served and displayed within the Developer Apps, less (i) any refunds to Advertisers; (ii) a deduction of up to 10% to cover expenses related to Advertiser discounts, payment transaction fees, telecommunications, data center and other serving costs, (iii) any amounts payable by Vungle to providers of targeting, reporting, verification or other data, technology or services used in connection with a given campaign hereunder, and (iv) Invalid Impressions. The Developer Fee shall be based on the impression or app installation counts used by the applicable Advertiser(s). For the avoidance of doubt, all Developer Fees are based on advertisement requests from the Developer Apps that are actually fulfilled with Vungle Ads. All revenue received from activities that Vungle deems to be due to fraud, Invalid Impressions, or technical error may be refunded to the Advertiser(s) in Vungle’s sole discretion. 28 | B. Developer Fee Addendums. During the Term of this Agreement, the parties may enter into one or more separate written publisher addendums (each a, “Fee Addendum”) setting forth modifications to the Developer Fee, bonus fees, or other incentives for a limited time period and/or specific advertising campaign. Each Fee Addendum shall, upon full execution by the parties, become a part of this Agreement and subject to all of its terms and conditions. 29 | C. Payment Terms; Taxes. Vungle will pay any Developer Fee due to Developer sixty (60) days’ after the completion of the month in which such Vungle Ads are served and displayed; provided that, Vungle may withhold payment until the following month for Developer Fee amounts less than $50 U.S. Developer shall be responsible for any bank, transfer or transaction fees (e.g., PayPal). Vungle may deduct any withholding, sales, value added, and other applicable taxes (other than its net income taxes) as required by law. Specifically, Vungle will deduct withholding tax, unless Developer provides a certification to Vungle, upon execution of this Agreement, certifying that Developer and the Developer Apps perform wholly outside of the U.S. Developer is responsible for paying, and will indemnify and hold Vungle forever harmless for, any taxes, duties, or fees, including interest and penalties, for which Developer is legally responsible, or that result from an inaccurate certification where Developer or the Developer Apps do in fact perform within the U.S. 30 | 7. Term and Termination. 31 | A. Term. This Agreement is effective until terminated in accordance with this Agreement. 32 | B. Termination/Suspension by Vungle. Vungle may terminate this Agreement at any time by providing sixty (60) days’ notice to Developer. Additionally, Vungle may terminate this Agreement immediately if Developer breaches any provision of this Agreement. Vungle may immediately suspend Developer’s access to the Vungle Platform if Vungle reasonably believes Developer has breached this Agreement. 33 | C. Termination by Developer. Developer may terminate this Agreement at any time by providing written notice to Vungle (email to suffice), ceasing all use of the Vungle Platform and Vungle Property, and destroying or removing from all hard drives, networks, and other storage media all copies of the Vungle Property. 34 | D. Effect of Termination. Upon termination of this Agreement by Developer, the Agreement (including all rights and licenses granted and obligations assumed hereunder) will remain in force and effect until the completion of all Vungle Ad campaigns associated with the Developer Apps in effect on the date of such termination (“Sell-Off Period”). Vungle’s payment obligations will remain in effect during the Sell-Off Period. Upon any termination of this Agreement, each party will promptly return or destroy all copies of any Confidential Information in its possession or control. Sections 3, 5(A), 6(C), 7(D) through 13 shall survive any expiration or termination of this Agreement. 35 | 8. Confidentiality. 36 | A. Definition. “Confidential Information” means any and all business, technical and financial information or material of a party, whether revealed orally, visually, or in tangible or electronic form, that is not generally known to the public, which is disclosed to or made available by one party (the “Disclosing Party”) to the other, or which one party becomes aware of pursuant to this Agreement (the “Receiving Party”). The Vungle SDK is Vungle’s Confidential Information, and the terms and conditions of this Agreement shall remain confidential. The failure of a Disclosing Party to designate as “confidential” any such information or material at the time of disclosure shall not result in a loss of status as Confidential Information to the Disclosing Party. Confidential Information shall not include information which: (i) is in or has entered the public domain through no breach of this Agreement or other act by a Receiving Party; (ii) a Receiving Party rightfully knew prior to the time that it was disclosed to a Receiving Party hereunder; (iii) a Receiving Party received without restriction from a third-party lawfully possessing and lawfully entitled to disclose such information without breach of this Agreement; or (iv) was independently developed by employees of the Receiving Party who had no access to such information. 37 | B. Use and Disclosure Restrictions. The Receiving Party shall not use the Confidential Information except as necessary to exercise its rights or perform its obligations under this Agreement, and shall not disclose the Confidential Information to any third party, except to those of its employees, subcontractors, and advisors that need to know such Confidential Information for the purposes of this Agreement, provided that each such employee, subcontractor, and advisor is subject to a written agreement that includes binding use and disclosure restrictions that are at least as protective of the Confidential Information as those set forth herein. The Receiving Party will use at least the efforts such party ordinarily uses with respect to its own confidential information of similar nature and importance to maintain the confidentiality of all Confidential Information in its possession or control, but in no event less than reasonable efforts. The foregoing obligations will not restrict the Receiving Party from disclosing any Confidential Information required by applicable law; provided that, the Receiving Party must use reasonable efforts to give the Disclosing Party advance notice thereof (i.e., so as to afford Disclosing Party an opportunity to intervene and seek an order or other relief for protecting its Confidential Information from any unauthorized use or disclosure) and the Confidential Information is only disclosed to the extent required by law. The Receiving Party shall return all of the Disclosing Party’s Confidential Information to the Disclosing Party or destroy the same, no later than fifteen (15) days after Disclosing Party’s request, or when Receiving Party no longer needs Confidential Information for its authorized purposes hereunder. 38 | 9. Representations and Warranties of Developer. 39 | Developer represents, warrants and covenants to Vungle that: (a) it shall comply with all applicable laws, rules, and regulations with respect to the operation of its business and its use of the Vungle SDK and Vungle Platform; (b) it has all necessary rights, title, and interest in and to the Developer Apps, and it has obtained all necessary rights, releases, and permissions to grant the rights granted to Vungle in this Agreement, including to allow Vungle to sell and insert the Vungle Ads as contemplated herein; (c) the Developer Apps will comply with the Developer Apps Content Policy, and will not infringe upon, violate, or misappropriate any third party right, including any intellectual property, privacy, or publicity rights; (d) any App Data Developer may provide to Vungle, and the ability for Vungle to collect App Data and Performance Data, is permitted under Developer’s privacy notice and provided in compliance with all applicable laws; and (e) it has made any and all disclosures and obtained any and all consents or permissions required by applicable laws with respect to Developer’s privacy practices, including without limitation: (i) any end user data Developer collects, uses, and/or discloses, (ii) the use and disclosure of App Data and Performance Data to Vungle via the Vungle SDK and Vungle Platform, and (iii) notice and parental consent required by applicable privacy laws, including COPPA. 40 | 10. Warranty Disclaimer. 41 | THE VUNGLE SDK AND VUNGLE PLATFORM ARE PROVIDED “AS IS.” VUNGLE DOES NOT MAKE ANY WARRANTIES, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, AND ANY IMPLIED WARRANTIES ARISING FROM COURSE OF DEALING OR PERFORMANCE. VUNGLE AND ITS SUPPLIERS, LICENSORS, AND PARTNERS DO NOT WARRANT THAT THE VUNGLE PLATFORM OR VUNGLE SDK WILL BE CORRECT, UNINTERRUPTED OR ERROR-FREE, THAT DEFECTS WILL BE CORRECTED, OR THAT THE VUNGLE PLATFORM OR VUNGLE SDK ARE FREE OF VIRUSES OR OTHER HARMFUL COMPONENTS. VUNGLE DOES NOT WARRANT THE RESULTS OF USE OF THE VUNGLE PLATFORM OR VUNGLE SDK. DEVELOPER ACKNOWLEDGES AND AGREES THAT VUNGLE MAY MODIFY OR SUSPEND THE VUNGLE PLATFORM AT ANY TIME IN ITS SOLE DISCRETION AND WITHOUT NOTICE. 42 | 11. Indemnification. 43 | A. Developer Indemnification. Developer agrees to indemnify, defend, and hold harmless Vungle and its affiliates, and their directors, officers, employees, and agents from and against any liabilities, damages, costs and expenses (including reasonable attorneys’ fees) arising out of any claim, demand, action, or proceeding initiated by a third party arising from or in connection with any breach of Developer’s obligations, representations or warranties set forth in this Agreement; provided that, Vungle: (a) promptly notifies Developer in writing of the claim, except that any failure to provide this notice promptly only relieves Developer of its responsibility to the extent its defense is materially prejudiced by the delay; (b) grants Developer sole control of the defense and/or settlement of the claim, but Developer shall not settle any claim without the prior written consent of Vungle; and (c) reasonably cooperates with Developer in connection with such claim at Developer’s cost and expense. 44 | B. Vungle Indemnification. Vungle agrees to indemnify, reimburse and hold harmless, Developer, its officers, directors, employees, and agents from and against any and all third party claims, liabilities, demands, causes of action, damages, losses and expenses, including, without limitation, reasonable attorneys' fees and costs of suit, arising out of or in connection with Vungle’s infringement or misappropriation of a third party U.S. copyright, trademark or trade secret by the use of the Vungle Platform and/or the Vungle SDK by Developer as permitted hereunder; provided that, Developer: (a) promptly notifies Vungle in writing of the claim, except that any failure to provide this notice promptly only relieves Vungle of its responsibility to the extent its defense is materially prejudiced by the delay; (b) grants Vungle sole control of the defense and/or settlement of the claim; and (c) reasonably cooperates with Vungle in connection with such claim at Vungle’s cost and expense. In addition, if the use of the Vungle Property by Developer has become, or in Vungle’s opinion is likely to become, the subject of any claim of infringement, Vungle may at its option and expense (i) procure for Developer the right to continue using the Vungle Property as set forth hereunder; (ii) replace or modify the Vungle Property to make it non-infringing so long as the Vungle Property has substantially equivalent functionality; or (iii) if options (i) or (ii) are not reasonably practicable, terminate this Agreement. Vungle shall have no liability or obligation under this Section with respect to any claim if such claim is caused in whole or in part by (w) compliance with designs, data, instructions, or specifications provided by Developer; (x) modification of the Vungle Property by any party other than Vungle without Vungle’s express consent; (y) failure to integrate any SDK Update and utilize the most up to date version of the Vungle SDK, or (z) the combination, operation, or use of the Vungle Property with other applications, portions of applications, product(s), data or services where the Vungle Property would not by itself be infringing. The indemnification rights contained in this Section 11 are Developer’s sole remedy for third party infringement claims relating to THE Vungle SDK and the Vungle Platform. 45 | 12. Limitation of Liability. 46 | EXCEPT WITH RESPECT TO INDEMNIFICATION OBLIGATIONS HEREIN AND BREACHES OF SECTION 2 (VUNGLE SDK LICENSE), NEITHER PARTY SHALL BE LIABLE TO OTHER PARTY FOR ANY PUNITIVE, INCIDENTAL, INDIRECT, SPECIAL, RELIANCE OR CONSEQUENTIAL DAMAGES, INCLUDING LOST BUSINESS, DATA, REVENUE, OR ANTICIPATED PROFITS, WHETHER BASED ON BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, AND WHETHER OR NOT A PARTY WAS ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. EXCEPT WITH RESPECT TO INDEMNIFICATION OBLIGATIONS HEREIN AND BREACHES OF SECTION 2 (VUNGLE SDK LICENSE), IN NO EVENT WILL EITHER PARTY’S AGGREGATE LIABILITY UNDER THIS AGREEMENT EXCEED THE TOTAL DEVELOPER FEE PAYABLE TO DEVELOPER UNDER THIS AGREEMENT BY VUNGLE IN THE TWELVE (12) MONTH PERIOD IMMEDIATELY PRECEDING THE DATE OF THE CLAIM . 47 | 13. General. 48 | A. Relationship of the Parties. Each Party shall be and act as an independent contractor and not as partner, joint venturer, or agent of the other. No party shall have any right to obligate or bind any other party. 49 | B. Assignment. Neither party may assign any of its rights or obligations under this Agreement without the prior written consent of the other party, except in connection with any merger (by operation of law or otherwise), consolidation, reorganization, change in control or sale of all or substantially all of its assets related to this Agreement or similar transaction. Notwithstanding the foregoing, Developer may not assign this Agreement to a direct competitor of Vungle without Vungle’s prior written consent. This Agreement inures to the benefit of and shall be binding on the parties’ permitted assignees, transferees and successors. 50 | C. Force Majeure. Neither party will be responsible for any failure or delay in its performance under this Agreement due to causes beyond its reasonable control, including, but not limited to, labor disputes, strikes, lockouts, internet or telecommunications failures, shortages of or inability to obtain labor, energy, or supplies, war, terrorism, riot, acts of God or governmental action, acts by hackers or other malicious third parties and problems with the Internet generally, and such performance shall be excused to the extent that it is prevented or delayed by reason of any of the foregoing. 51 | D. Notices. Vungle may provide Developer with business or operational notices via email or posting of such notice within the Vungle Platform. All legal notices under the terms of this Agreement shall be in writing and sent to Developer as provided to Vungle in the account information during the download of the SDK, and to Vungle in accordance with this Section. All notices in connection with this Agreement shall be deemed given (a) when personally delivered; (b) three (3) days after being sent by the United States of America mail, postage prepaid, certified or registered, return receipt requested; or (c) one (1) day after being sent by a reputable overnight delivery service. Notices to Vungle must be sent to: Vungle, Inc., 185 Clara St. #100, San Francisco, CA 94107, Attn: Legal Department. 52 | E. Amendments; Waiver. No changes or modifications or waivers are to be made to this Agreement unless evidenced in writing and signed for and on behalf of both parties. The failure by either party to insist upon the strict performance of this Agreement, or to exercise any term hereof, will not act as a waiver of any right, promise or term, which will continue in full force and effect. 53 | F. Construction. This Agreement shall be fairly interpreted and construed in accordance with its terms and without strict interpretation or construction in favor of or against either party. 54 | G. Severability. If any provision, or portion thereof, of this Agreement is determined by a court of competent jurisdiction to be invalid, illegal or unenforceable, such determination will not impair or affect the validity, legality, or enforceability of the remaining provisions of this Agreement, and each provision, or portion thereof, is hereby declared to be separate, severable, and distinct. 55 | H. Governing Law; Jurisdiction. This Agreement shall be governed by, and construed in accordance with, the laws of the State of California, without reference to conflicts of laws principles. The parties agree that the federal and state courts in San Francisco County, California will have exclusive jurisdiction and venue under this Agreement, and the parties hereby agree to submit to such jurisdiction exclusively. 56 | I. Entire Agreement. This Agreement, together with Exhibit A attached hereto and incorporated herein by reference, contains the entire understanding of the parties regarding its subject matter and supersedes all other agreements and understandings, whether oral or written. 57 | J. Counterparts. This Agreement may be signed in counterparts, including by facsimile or electronic copy, each of which will be deemed an original, and all such counterparts together constituting one and the same Agreement. 58 | ACCEPTED AND AGREED to as of the date upon Developer’s download or use of the Vungle SDK by the authorized representative of each party. 59 | Exhibit A to Vungle SDK License and Publisher Terms 60 | Vungle Data Privacy Addendum (Publishers) 61 | This Data Privacy Addendum ("Addendum") forms part of Vungle SDK License and Publisher Terms ("Agreement") in place between Vungle, Inc. and the company identified as the "Developer" in the Agreement. Capitalized terms used in this Addendum shall have the meaning given to them in the main body of the Agreement unless otherwise defined in this Addendum. 62 | IT IS AGREED: 63 | 1. Definitions. 64 | "Ad Data" has the meaning given to it in Section 2 of this Addendum; 65 | "Controller" means the entity that determines the purposes and means of the processing of Personal Data; 66 | "Demand Partners" means Vungle's media buying clients, including but not limited to Advertisers and attribution partners, demand side platforms, ad exchanges, agencies, agency trading desks and ad networks who submit "bids" for Vungle Ad inventory; 67 | "EU Data Protection Law" means (i) prior to 25 May 2018, the EU Data Protection Directive (Directive 95/46/EC) and on and after 25 May 2018, the EU General Data Protection Regulation (Regulation 2016/679); (ii) the EU e-Privacy Directive (Directive 2002/58/EC); and (iii) any national data protection laws made under or pursuant to (i) or (ii) (in each case, as superseded, amended or replaced); 68 | "Personal Data" means any information relating to an identified or identifiable natural person (which shall include for the avoidance of doubt, any personally identifiable information) or as otherwise defined in applicable Privacy Requirements; 69 | "Privacy Requirements" means all applicable privacy and data protection laws and regulations, industry self-regulatory rules, codes and guidelines that apply to the processing of data (including Ad Data and Personal Data) that is the subject of this Addendum, in each case as amended, superseded, or replaced, including but not limited to EU Data Protection Law; 70 | "Privacy Shield" means the EU-U.S. Privacy Shield Framework self-certification program operated by the U.S. Department of Commerce and approved by the European Commission pursuant to Decision C(2016)4176 of 12 July 2016 and by the Swiss Federal Council on January 11, 2017 respectively; 71 | ”Privacy Shield Principles” means the Privacy Shield Framework Principles (as supplemented by the Supplemental Principles) contained in Annex II to the European Commission Decision C(2016)4176 of July 12, 2016 (as may be amended, superseded or replaced); 72 | "Tracking Technologies" means mobile SDKs, unique identifiers, pixels, and similar tracking technologies; 73 | "Vungle Privacy Notice" means the Vungle privacy notice available on Vungle's public facing website ( http://vungle.com/privacy), as updated from time to time; 74 | "data subject", "processing" (and "process") shall have the meanings given to them in EU Data Protection Law. 75 | 2. Scope of Processing. 76 | 2.1. Developer acknowledges and agrees that in connection with the Vungle Platform and Vungle SDK: (i) Vungle may collect or otherwise receive data (including Personal Data) relating to end users of the Developer Apps (such as App Data), including unique device identifiers, log information, as well as usage data (such as Performance Data), including information about ads viewed or clicked, post-install data, geo-location of an end user’s device (as may be enabled by the Developer App) and streaming data, all as more particularly described in the Vungle Privacy Notice (collectively "Ad Data"); and (ii) Vungle and its Demand Partners use Tracking Technologies in order to collect certain Ad Data. 77 | 2.2. Vungle shall process and Developer hereby grants Vungle a perpetual, irrevocable, worldwide, sublicenseable right and license to use, copy, modify, distribute and otherwise exploit Ad Data for the following purposes: (a) accessing or calling the Developer Apps, or the servers that make them available, to cause the routing, serving, displaying, targeting, and tracking the performance of Vungle Ads on the Developer Apps; (b) building and storing profiles of end users; (c) using Ad Data for Vungle’s internal business purposes, including to develop and improve the Vungle SDK and Vungle Platform; (e) for any other purposes identified in the Vungle Privacy Notice; and/or (d) disclosing Ad Data (i) to third parties (including Demand Partners) as reasonably necessary in connection with the operation of the Vungle Platform, (ii) if required by any court order, process, law or governmental agency; and/or (iii) generally when it is aggregated, such that the specific information relating to Developer or any underlying end user is not directly identifiable ("Permitted Purposes"). 78 | 3. Relationship of the Parties. 79 | To the extent the Ad Data contains Personal Data, Vungle shall process such data as a separate and independent Controller (where applicable Privacy Requirements recognize such concept) and only for the Permitted Purposes. In no event will the parties process Personal Data under this Agreement as joint Controllers. Nothing in the Agreement (including this Addendum) shall limit or prevent Vungle from collecting or using data that Vungle would otherwise collect and process independently of Developer's use of the Vungle Platform and Vungle SDK. 80 | 4. Developer's Responsibilities. 81 | 4.1. Privacy Notice. (a) Developer represents and warrants that it shall conspicuously post, maintain, and abide by a publically accessible privacy notice within the Developer App that satisfies the transparency and information requirements of the Privacy Requirements and the Agreement (including this Addendum). If notice cannot be provided in or around Vungle Ads, then Developer should make arrangements to provide notice within the Developer App or on the landing page of the Vungle Ad. 82 | (b) Without prejudice to the generality of the foregoing, such notice shall, at a minimum, include clear and comprehensive information about the following: (i) Vungle and its Demand Partner's use of Tracking Technology to collect use and share Ad Data; (ii) the fact that third parties may collect or receive Personal Data and use that Personal Data to provide measurement services and targeted ads; (iii) a conspicuous link to or description of how and where users can opt-out of collection and use of information for ad targeting; and (vi) a description of the types of Ad Data (including Personal Data) that are collected and how and for what purposes the Ad Data collected will be used or transferred to third parties. 83 | (c) To the extent Ad Data is protected by EU Data Protection Law, Developer further warrants and represents that the privacy notice provided pursuant to Section 4.1(a) (above) shall also include the following information: (i) the type of Personal Data collected by Vungle and its Demand Partners and the purposes of processing thereof;(ii) the categories of individuals who will have access to the Personal Data; (iii) where applicable, the legitimate interests pursued by Vungle and/or its Demand Partners; (iv) the identity of the Controller(s); and (v) and any other information required to comply with the transparency requirements of the EU Data Protection Law. 84 | 4.2. Notice and Consent. Developer represents and warrants it has provided (and shall maintain) all required notices and obtained all necessary permissions and consents in accordance with the Privacy Requirements from the relevant data subjects (including any parental consent required by applicable Privacy Requirements) on behalf of Vungle and all applicable Demand Partners to lawfully permit: (a) Vungle and all applicable Demand Partners to collect, process and share Ad Data; and (b) deploy Tracking Technologies in order to collect Ad Data from the devices of end users served with Vungle Ads, in each case for the purposes contemplated by this Addendum. 85 | 4.3. Consent Mechanism. Where Developer is responsible for obtaining consent in accordance with Section 4.2 above, Developer shall, at all times, make available, maintain and make operational on the Developer Properties: (i) a mechanism for obtaining such consent from data subjects in accordance with the requirements of the Privacy Requirements; and (ii) a mechanism for data subjects to withdraw such consent (opt-out) in accordance with the Privacy Requirements. 86 | 4.4. Consent Records. Where Developer is responsible for obtaining consent in accordance with Section 4.2 above, Developer shall maintain a record of all consents obtained from data subjects as required by the Privacy Requirements, including the time and date on which consent was obtained, the information presented to data subjects in connection with their giving consent, and details of the mechanism used to obtain consent. Developer shall maintain a record of the same information in relation to all withdrawals of consent by data subjects. Developer shall make these records available to Vungle promptly upon request. 87 | If Developer is unable to comply with its notice and consent obligations under this Addendum, Developer shall promptly notify Vungle and Vungle may elect to perform any one or all of the obligations provided Developer does not prevent Vungle from performing such obligations. In the event neither party is able to perform such obligations, Vungle shall have the right to terminate the Agreement without liability upon written notice. 88 | 4.5. Prohibited Data Sharing. Developer shall not: (i) share with Vungle any Personal Data that allows users of Developer Apps to be directly identified (for example, by reference to their name or email address); and (ii) pass to Vungle any personal data of children (as such term is defined under applicable Privacy Requirements), unless expressly agreed in writing and as permitted under Privacy Requirements. Upon request, Vungle shall provide Developer with such reasonable assistance as Developer may require to enable Developer to provide such notice and obtain such consents. 89 | 5. Co-operation and Data Subject Rights. 90 | The parties shall, on request, provide each other with all reasonable and timely assistance (at their own expense) to enable the other to comply with its obligations under the Privacy Requirements, specifically in order to enable the other to respond to: (i) any request from a data subject to exercise any of its rights under EU Data Protection Law (including its rights of access, correction, objection, erasure and data portability, as applicable) in relation to the Ad Data ("Data Subject Rights"); and (ii) any other correspondence, inquiry, or complaint received from a data subject, regulator, or other third party in connection with the processing of the Ad Data. Each party shall promptly inform the other if it receives any request directly from a data subject to exercise a Data Subject Right in relation to the Ad Data. 91 | 6. International Transfers. 92 | To the extent that Vungle processes (or causes to be processed) any Personal Data protected by EU Data Protection Law and/or originating from the EEA (including the United Kingdom) ("EEA Personal Data") in a country outside of the EEA, it shall first take all such measures as are necessary to ensure an adequate level of protection for such EEA Personal Data in accordance with the requirements of EU Data Protection Law. For these purposes, the parties acknowledge and agree that Vungle shall provide adequate protection for any EEA Personal Data by virtue of Vungle having self-certified its compliance with the Privacy Shield. Vungle agrees to protect EEA Personal Data in accordance with the requirements of the Privacy Shield Principles. 93 | 7. Vungle Data. 94 | To the extent Vungle shares any Personal Data with Developer in connection with the Vungle SDK and Vungle Platform, the parties agree that (i) Developer shall process such data as a separate and independent Controller (where applicable Privacy Requirements recognize such concept) for the limited purpose of performance under this Agreement consistent with the consents given by the data subjects; and (ii) Developer shall be independently responsible for the obligations that apply to it as a Controller under the Privacy Requirements. Developer further acknowledges that Vungle is self-certifying its compliance to the Privacy Shield and may transfer to Developer Personal Data protected by EU Data Protection Laws. To the extent Developer processes any such data, Developer agrees to provide the same level of protection for such Personal Data as is required by the Privacy Shield Principles. Developer shall notify Vungle if it makes a determination that it can no longer provide such protection and in such event, shall cease processing or take other reasonable and appropriate steps to remediate (if remediable) any processing until such time as the processing meets the level of protection as is required by the Privacy Shield Principles. 95 | 8. Miscellaneous. 96 | 8.1. Vungle reserves the right to modify, suspend or terminate the Agreement should Developer violate this Addendum. 97 | 8.2. This Addendum shall survive termination or expiry of the Agreement. Upon termination or expiry of the Agreement, Vungle may continue to process the Ad Data provided that such processing complies with the requirements of this Addendum and the Privacy Requirements. 98 | -------------------------------------------------------------------------------- /app/libs/core-1.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/libs/core-1.1.0.jar -------------------------------------------------------------------------------- /app/libs/gson-2.8.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/libs/gson-2.8.6.jar -------------------------------------------------------------------------------- /app/libs/localbroadcastmanager-1.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/libs/localbroadcastmanager-1.0.0.jar -------------------------------------------------------------------------------- /app/libs/okhttp-3.14.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/libs/okhttp-3.14.9.jar -------------------------------------------------------------------------------- /app/libs/okio-1.17.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/libs/okio-1.17.3.jar -------------------------------------------------------------------------------- /app/libs/vungle-android-sdk-6.12.1.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/libs/vungle-android-sdk-6.12.1.aar -------------------------------------------------------------------------------- /app/libs/vungle-android-sdk-6.12.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/libs/vungle-android-sdk-6.12.1.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/rahul.pal/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information fo 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | # Vungle 28 | -dontwarn com.vungle.warren.downloader.DownloadRequestMediator$Status 29 | -dontwarn com.vungle.warren.error.VungleError$ErrorCode 30 | 31 | # Google 32 | -keep class com.google.android.gms.** { *; } 33 | -dontwarn com.google.android.gms.** 34 | 35 | # GSON 36 | -keepattributes *Annotation* 37 | -keepattributes Signature 38 | # Prevent R8 from leaving Data object members always null 39 | -keepclassmembers,allowobfuscation class * { 40 | @com.google.gson.annotations.SerializedName ; 41 | } 42 | 43 | # OkHttp + Okio 44 | -dontwarn javax.annotation.** 45 | -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase 46 | -dontwarn org.codehaus.mojo.animal_sniffer.* 47 | -dontwarn okhttp3.internal.platform.ConscryptPlatform 48 | 49 | -dontwarn module-info 50 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/publisher/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.publisher.sample; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.publisher.sample", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 | 38 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/publisher/sample/BannerListActivity.java: -------------------------------------------------------------------------------- 1 | package com.publisher.sample; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import androidx.annotation.NonNull; 7 | import androidx.appcompat.app.AppCompatActivity; 8 | import androidx.recyclerview.widget.LinearLayoutManager; 9 | import androidx.recyclerview.widget.RecyclerView; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | public class BannerListActivity extends AppCompatActivity { 15 | 16 | private static final String PLACEMENT_ID = "placement_id"; 17 | private static final Integer SIZE = 40; 18 | private static final int POSITION = 20; 19 | 20 | private RecyclerView recyclerView; 21 | private VungleBannerAdAdapter adapter; 22 | 23 | public static Intent getIntent(Context ctx, String placementReferenceId) { 24 | Intent intent = new Intent(ctx, BannerListActivity.class); 25 | intent.putExtra(PLACEMENT_ID, placementReferenceId); 26 | return intent; 27 | } 28 | 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.activity_banner_list); 33 | String placement = getIntent().getStringExtra(PLACEMENT_ID); 34 | 35 | recyclerView = findViewById(R.id.rv_list); 36 | LinearLayoutManager manager = new LinearLayoutManager(this); 37 | manager.setOrientation(RecyclerView.VERTICAL); 38 | recyclerView.setLayoutManager(manager); 39 | 40 | RVAdapter originalAdapter = new RVAdapter(SIZE); 41 | adapter = new VungleBannerAdAdapter(placement, POSITION, originalAdapter, null); 42 | recyclerView.setAdapter(adapter); 43 | recyclerView.setHasFixedSize(true); 44 | } 45 | 46 | @Override 47 | protected void onDestroy() { 48 | adapter.destroy(); 49 | recyclerView.setAdapter(null); 50 | super.onDestroy(); 51 | } 52 | 53 | //simple adapter implementation 54 | private static class RVAdapter extends RecyclerView.Adapter { 55 | private final Integer size; 56 | 57 | RVAdapter(Integer size) { 58 | this.size = size; 59 | } 60 | 61 | @NonNull 62 | @Override 63 | public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int type) { 64 | View view = LayoutInflater.from(viewGroup.getContext()).inflate(type, viewGroup, false); 65 | return new ItemHolder(view); 66 | } 67 | 68 | @Override 69 | public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { 70 | ((ItemHolder) viewHolder).bind(String.valueOf(position)); 71 | } 72 | 73 | @Override 74 | public int getItemCount() { 75 | return size; 76 | } 77 | 78 | @Override 79 | public int getItemViewType(int position) { 80 | return R.layout.rv_item; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/publisher/sample/BannerMultipleActivity.java: -------------------------------------------------------------------------------- 1 | package com.publisher.sample; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.util.Log; 7 | import android.view.View; 8 | import android.widget.Button; 9 | import android.widget.FrameLayout; 10 | import android.widget.Toast; 11 | 12 | import androidx.annotation.NonNull; 13 | import androidx.annotation.Nullable; 14 | import androidx.appcompat.app.AppCompatActivity; 15 | 16 | import com.vungle.warren.AdConfig; 17 | import com.vungle.warren.BannerAdConfig; 18 | import com.vungle.warren.Banners; 19 | import com.vungle.warren.LoadAdCallback; 20 | import com.vungle.warren.PlayAdCallback; 21 | import com.vungle.warren.Vungle; 22 | import com.vungle.warren.VungleBanner; 23 | import com.vungle.warren.error.VungleException; 24 | 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | 28 | public class BannerMultipleActivity extends AppCompatActivity { 29 | protected static String PACKAGE_NAME; 30 | 31 | private VungleBanner vungleBannerAd; 32 | 33 | private List vungleBannerAds = new ArrayList<>(); 34 | 35 | final private String bannerTop = "banner_top"; 36 | final private String bannerMiddle = "banner_middle"; 37 | final private String bannerBottom = "banner_bottom"; 38 | 39 | private static final String LOG_TAG = "VungleSamplApp"; 40 | 41 | public static Intent getIntent(Context ctx) { 42 | Intent intent = new Intent(ctx, BannerMultipleActivity.class); 43 | return intent; 44 | } 45 | 46 | @Override 47 | protected void onCreate(@Nullable Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | setContentView(R.layout.activity_banner_multiple); 50 | 51 | PACKAGE_NAME = getApplicationContext().getPackageName(); 52 | 53 | Log.d(LOG_TAG, PACKAGE_NAME); 54 | 55 | vungleBannerAds.add(new VungleBannerAd(bannerTop)); 56 | vungleBannerAds.add(new VungleBannerAd(bannerMiddle)); 57 | vungleBannerAds.add(new VungleBannerAd(bannerBottom)); 58 | 59 | initUIElements(); 60 | } 61 | 62 | private void initUIElements() { 63 | Log.d(LOG_TAG, "Initialize Multiple Banner Ad"); 64 | 65 | for (VungleBannerAd vungleBannerAd : vungleBannerAds) { 66 | setVungleBannerAdUi(vungleBannerAd); 67 | 68 | if (Vungle.canPlayAd(vungleBannerAd.placementReferenceId)) { 69 | enableButton(vungleBannerAd.playButton); 70 | } else { 71 | enableButton(vungleBannerAd.loadButton); 72 | } 73 | } 74 | } 75 | 76 | 77 | private final PlayAdCallback vunglePlayAdCallback = new PlayAdCallback() { 78 | @Override 79 | public void onAdStart(final String placementReferenceID) { 80 | Log.d(LOG_TAG, "PlayAdCallback - onAdStart" + 81 | "\n\tPlacement Reference ID = " + placementReferenceID); 82 | disableButton(getVungleAd(placementReferenceID).playButton); 83 | } 84 | 85 | @Override 86 | public void onAdViewed(String placementReferenceID) { 87 | Log.d(LOG_TAG, "PlayAdCallback - onAdViewed" + 88 | "\n\tPlacement Reference ID = " + placementReferenceID); 89 | } 90 | 91 | // Deprecated 92 | @Override 93 | public void onAdEnd(final String placementReferenceID, final boolean completed, final boolean isCTAClicked) { 94 | Log.d(LOG_TAG, "PlayAdCallback - onAdEnd" + 95 | "\n\tPlacement Reference ID = " + placementReferenceID + 96 | "\n\tView Completed = " + completed + "" + 97 | "\n\tDownload Clicked = " + isCTAClicked); 98 | } 99 | 100 | @Override 101 | public void onAdEnd(String placementReferenceID) { 102 | Log.d(LOG_TAG, "PlayAdCallback - onAdEnd" + 103 | "\n\tPlacement Reference ID = " + placementReferenceID); 104 | } 105 | 106 | @Override 107 | public void onAdClick(String placementReferenceID) { 108 | Log.d(LOG_TAG, "PlayAdCallback - onAdClick" + 109 | "\n\tPlacement Reference ID = " + placementReferenceID); 110 | } 111 | 112 | @Override 113 | public void onAdRewarded(String placementReferenceID) { 114 | // Not applicable for banner ads 115 | } 116 | 117 | @Override 118 | public void onAdLeftApplication(String placementReferenceID) { 119 | Log.d(LOG_TAG, "PlayAdCallback - onAdLeftApplication" + 120 | "\n\tPlacement Reference ID = " + placementReferenceID); 121 | } 122 | 123 | @Override 124 | public void creativeId(String creativeId) { 125 | Log.d(LOG_TAG, "PlayAdCallback - creativeId" + 126 | "\n\tCreative ID = " + creativeId); 127 | } 128 | 129 | @Override 130 | public void onError(final String placementReferenceID, VungleException vungleException) { 131 | Log.d(LOG_TAG, "PlayAdCallback - onError" + 132 | "\n\tPlacement Reference ID = " + placementReferenceID + 133 | "\n\tError = " + vungleException.getLocalizedMessage()); 134 | 135 | makeToast(vungleException.getLocalizedMessage()); 136 | } 137 | }; 138 | 139 | private final LoadAdCallback vungleLoadAdCallback = new LoadAdCallback() { 140 | @Override 141 | public void onAdLoad(final String placementReferenceID) { 142 | Log.d(LOG_TAG, "LoadAdCallback - onAdLoad" + 143 | "\n\tPlacement Reference ID = " + placementReferenceID); 144 | 145 | enableButton(getVungleAd(placementReferenceID).playButton); 146 | } 147 | 148 | @Override 149 | public void onError(final String placementReferenceID, VungleException vungleException) { 150 | Log.d(LOG_TAG, "LoadAdCallback - onError" + 151 | "\n\tPlacement Reference ID = " + placementReferenceID + 152 | "\n\tError = " + vungleException.getLocalizedMessage()); 153 | 154 | makeToast(vungleException.getLocalizedMessage()); 155 | enableButton(getVungleAd(placementReferenceID).loadButton); 156 | } 157 | }; 158 | 159 | private void setVungleBannerAdUi(final VungleBannerAd ad) { 160 | switch (ad.name) { 161 | case bannerTop: 162 | case bannerBottom: 163 | setBannerAd(ad, AdConfig.AdSize.BANNER); 164 | break; 165 | case bannerMiddle: 166 | setBannerAd(ad, AdConfig.AdSize.VUNGLE_MREC); 167 | break; 168 | default: 169 | Log.d(LOG_TAG, "Vungle ad type not recognized"); 170 | break; 171 | } 172 | } 173 | 174 | private void setBannerAd(final VungleBannerAd ad, final AdConfig.AdSize adSize) { 175 | final BannerAdConfig bannerAdConfig = new BannerAdConfig(); 176 | bannerAdConfig.setAdSize(adSize); 177 | bannerAdConfig.setMuted(true); 178 | 179 | ad.loadButton.setOnClickListener(new View.OnClickListener() { 180 | @Override 181 | public void onClick(View view) { 182 | if (Vungle.isInitialized()) { 183 | Banners.loadBanner(ad.placementReferenceId, bannerAdConfig, vungleLoadAdCallback); 184 | 185 | disableButton(ad.loadButton); 186 | } else { 187 | makeToast("Vungle SDK not initialized"); 188 | } 189 | } 190 | }); 191 | 192 | ad.playButton.setOnClickListener(new View.OnClickListener() { 193 | @Override 194 | public void onClick(View view) { 195 | if (Vungle.isInitialized()) { 196 | if (Banners.canPlayAd(ad.placementReferenceId, adSize)) { 197 | if (vungleBannerAd != null) { 198 | vungleBannerAd = null; 199 | ad.container.removeAllViews(); 200 | } 201 | 202 | vungleBannerAd = Banners.getBanner(ad.placementReferenceId, bannerAdConfig, vunglePlayAdCallback); 203 | 204 | if (vungleBannerAd != null) { 205 | ad.container.addView(vungleBannerAd); 206 | ad.container.setVisibility(View.VISIBLE); 207 | } 208 | // Button UI 209 | enableButton(ad.loadButton); 210 | disableButton(ad.playButton); 211 | enableButton(ad.pauseResumeButton); 212 | enableButton(ad.closeButton); 213 | 214 | ad.bannerAdPlaying = true; 215 | ad.pauseResumeButton.setText("PAUSE"); 216 | } else { 217 | makeToast("Vungle ad not playable for " + ad.placementReferenceId); 218 | } 219 | } else { 220 | makeToast("Vungle SDK not initialized"); 221 | } 222 | } 223 | }); 224 | 225 | ad.pauseResumeButton.setOnClickListener(new View.OnClickListener() { 226 | @Override 227 | public void onClick(View view) { 228 | ad.bannerAdPlaying = !ad.bannerAdPlaying; 229 | 230 | if (vungleBannerAd != null) { 231 | vungleBannerAd.setAdVisibility(ad.bannerAdPlaying); 232 | } 233 | 234 | ad.pauseResumeButton.setText(ad.bannerAdPlaying ? "PAUSE" : "RESUME"); 235 | } 236 | }); 237 | 238 | ad.closeButton.setOnClickListener(new View.OnClickListener() { 239 | @Override 240 | public void onClick(View view) { 241 | if (vungleBannerAd != null) { 242 | ad.container.removeView(vungleBannerAd); 243 | ad.container.setVisibility(View.GONE); 244 | vungleBannerAd.destroyAd(); 245 | vungleBannerAd = null; 246 | } 247 | 248 | disableButton(ad.pauseResumeButton); 249 | disableButton(ad.closeButton); 250 | } 251 | }); 252 | } 253 | 254 | private VungleBannerAd getVungleAd(String placementReferenceId) { 255 | for (VungleBannerAd vungleAd : vungleBannerAds) { 256 | if (vungleAd.placementReferenceId.equals(placementReferenceId)) { 257 | return vungleAd; 258 | } 259 | } 260 | return null; 261 | } 262 | 263 | private void enableButton(final Button button) { 264 | if (button == null) { return; } 265 | runOnUiThread(new Runnable() { 266 | @Override 267 | public void run() { 268 | button.setEnabled(true); 269 | button.setAlpha(1.0f); 270 | } 271 | }); 272 | } 273 | 274 | private void disableButton(final Button button) { 275 | if (button == null) { return; } 276 | runOnUiThread(new Runnable() { 277 | @Override 278 | public void run() { 279 | button.setEnabled(false); 280 | button.setAlpha(0.5f); 281 | } 282 | }); 283 | } 284 | 285 | private void makeToast(String message) { 286 | Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); 287 | } 288 | 289 | private class VungleBannerAd { 290 | @NonNull private final String name; 291 | @NonNull private final String placementReferenceId; 292 | @NonNull private final Button loadButton; 293 | @NonNull private final Button playButton; 294 | @NonNull private final Button pauseResumeButton; 295 | @NonNull private final Button closeButton; 296 | @NonNull private boolean bannerAdPlaying; 297 | @Nullable private final FrameLayout container; 298 | 299 | private VungleBannerAd(String name) { 300 | this.name = name; 301 | this.placementReferenceId = getPlacementReferenceId(); 302 | this.loadButton = getLoadButton(); 303 | this.playButton = getPlayButton(); 304 | this.pauseResumeButton = getPauseResumeButton(); 305 | this.closeButton = getCloseButton(); 306 | this.container = getContainer(); 307 | this.bannerAdPlaying = false; 308 | } 309 | 310 | private String getPlacementReferenceId() { 311 | int stringId = getResources().getIdentifier("placement_id_" + name, "string", PACKAGE_NAME); 312 | return getString(stringId); 313 | } 314 | 315 | private Button getLoadButton() { 316 | int buttonId = getResources().getIdentifier("btn_load_" + name, "id", PACKAGE_NAME); 317 | Button button = (Button) findViewById(buttonId); 318 | disableButton(button); 319 | return button; 320 | } 321 | 322 | private Button getPlayButton() { 323 | int buttonId = getResources().getIdentifier("btn_play_" + name, "id", PACKAGE_NAME); 324 | Button button = (Button) findViewById(buttonId); 325 | disableButton(button); 326 | return button; 327 | } 328 | 329 | private Button getPauseResumeButton() { 330 | int buttonId = getResources().getIdentifier("btn_pause_resume_" + name, "id", PACKAGE_NAME); 331 | Button button = (Button) findViewById(buttonId); 332 | disableButton(button); 333 | return button; 334 | } 335 | 336 | private Button getCloseButton() { 337 | int buttonId = getResources().getIdentifier("btn_close_" + name, "id", PACKAGE_NAME); 338 | Button button = (Button) findViewById(buttonId); 339 | disableButton(button); 340 | return button; 341 | } 342 | 343 | private FrameLayout getContainer() { 344 | int containerId = getResources().getIdentifier("container_" + name, "id", PACKAGE_NAME); 345 | FrameLayout container = (FrameLayout) findViewById(containerId); 346 | if (container != null) { 347 | return container; 348 | } 349 | return null; 350 | } 351 | } 352 | } 353 | -------------------------------------------------------------------------------- /app/src/main/java/com/publisher/sample/ItemHolder.java: -------------------------------------------------------------------------------- 1 | package com.publisher.sample; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.recyclerview.widget.RecyclerView; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | public class ItemHolder extends RecyclerView.ViewHolder { 9 | private final TextView textView; 10 | 11 | public ItemHolder(@NonNull View itemView) { 12 | super(itemView); 13 | textView = itemView.findViewById(R.id.tv_id); 14 | } 15 | 16 | void bind(String text) { 17 | textView.setText(text); 18 | } 19 | } -------------------------------------------------------------------------------- /app/src/main/java/com/publisher/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.publisher.sample; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.NonNull; 5 | import androidx.annotation.Nullable; 6 | import androidx.appcompat.app.AppCompatActivity; 7 | import android.util.Log; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.FrameLayout; 11 | import android.widget.TextView; 12 | import android.widget.Toast; 13 | 14 | import com.vungle.warren.BannerAdConfig; 15 | import com.vungle.warren.Banners; 16 | import com.vungle.warren.Vungle; 17 | import com.vungle.warren.AdConfig; // Custom ad configurations 18 | import com.vungle.warren.InitCallback; // Initialization callback 19 | import com.vungle.warren.LoadAdCallback; // Load ad callback 20 | import com.vungle.warren.PlayAdCallback; // Play ad callback 21 | import com.vungle.warren.VungleBanner; // Banner 22 | import com.vungle.warren.Vungle.Consent; // GDPR consent 23 | import com.vungle.warren.VungleSettings; 24 | import com.vungle.warren.error.VungleException; // onError message 25 | 26 | 27 | import java.util.List; 28 | import java.util.ArrayList; 29 | 30 | import static com.vungle.warren.Vungle.getValidPlacements; 31 | 32 | public class MainActivity extends AppCompatActivity { 33 | protected static String PACKAGE_NAME; 34 | 35 | private VungleBanner vungleBannerAd; 36 | 37 | final private List vungleAds = new ArrayList<>(); 38 | 39 | final private String interstitial = "interstitial"; 40 | final private String rewardedVideo = "rewarded_video"; 41 | final private String mrec = "mrec"; 42 | final private String banner = "banner"; 43 | 44 | final String LOG_TAG = "VungleSampleApp"; 45 | 46 | @Override 47 | protected void onCreate(Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | setContentView(R.layout.activity_main); 50 | 51 | PACKAGE_NAME = getApplicationContext().getPackageName(); 52 | 53 | vungleAds.add(new VungleAd(interstitial)); 54 | vungleAds.add(new VungleAd(rewardedVideo)); 55 | vungleAds.add(new VungleAd(mrec)); 56 | vungleAds.add(new VungleAd(banner)); 57 | 58 | initUiElements(); 59 | initSDK(); 60 | } 61 | 62 | private void initSDK() { 63 | final String appId = getString(R.string.app_id); 64 | 65 | final long MEGABYTE = 1024L * 1024L; 66 | final VungleSettings vungleSettings = 67 | new VungleSettings.Builder() 68 | .setMinimumSpaceForAd(20 * MEGABYTE) 69 | .setMinimumSpaceForInit(21 * MEGABYTE) 70 | .setAndroidIdOptOut(false) 71 | .build(); 72 | 73 | // COPPA example 74 | // Please call updateUserCoppaStatus before SDK initialization 75 | // Vungle.updateUserCoppaStatus(true); 76 | 77 | // CCPA example (default: OPTED_IN) 78 | // Vungle.updateCCPAStatus(Consent.OPTED_OUT); 79 | // Vungle.getCCPAStatus(); 80 | 81 | // GDPR example (default: OPTED_IN) 82 | // Vungle.updateConsentStatus(Consent.OPTED_OUT, "1.0.0"); 83 | // Vungle.getConsentStatus(); 84 | // Vungle.getConsentMessageVersion(); 85 | 86 | Vungle.init(appId, getApplicationContext(), new InitCallback() { 87 | @Override 88 | public void onSuccess() { 89 | makeToast("Vungle SDK initialized"); 90 | Log.d(LOG_TAG, "InitCallback - onSuccess"); 91 | Log.d(LOG_TAG, "Vungle SDK Version - " + com.vungle.warren.BuildConfig.VERSION_NAME); 92 | Log.d(LOG_TAG, "Valid placement list:"); 93 | 94 | for (String validPlacementReferenceIdId : getValidPlacements()) { 95 | Log.d(LOG_TAG, validPlacementReferenceIdId); 96 | } 97 | 98 | // Set button state according to ad playability 99 | for (VungleAd vungleAd : vungleAds) { 100 | if (Vungle.canPlayAd(vungleAd.placementReferenceId)) { 101 | enableButton(vungleAd.playButton); 102 | } else { 103 | enableButton(vungleAd.loadButton); 104 | } 105 | } 106 | 107 | // Set custom configuration for rewarded placements 108 | setCustomRewardedFields(); 109 | } 110 | 111 | @Override 112 | public void onError(VungleException vungleException) { 113 | if (vungleException != null) { 114 | Log.d(LOG_TAG, "InitCallback - onError: " + vungleException.getLocalizedMessage()); 115 | } else { 116 | Log.d(LOG_TAG, "VungleException is null"); 117 | } 118 | } 119 | 120 | @Override 121 | public void onAutoCacheAdAvailable(final String placementReferenceID) { 122 | Log.d(LOG_TAG, "InitCallback - onAutoCacheAdAvailable" + 123 | "\n\tPlacement Reference ID = " + placementReferenceID); 124 | 125 | VungleAd ad = getVungleAd(placementReferenceID); 126 | if (ad != null) { 127 | enableButton(ad.playButton); 128 | disableButton(ad.loadButton); 129 | } 130 | } 131 | }, vungleSettings); 132 | } 133 | 134 | private final PlayAdCallback vunglePlayAdCallback = new PlayAdCallback() { 135 | @Override 136 | public void onAdStart(final String placementReferenceID) { 137 | Log.d(LOG_TAG, "PlayAdCallback - onAdStart" + 138 | "\n\tPlacement Reference ID = " + placementReferenceID); 139 | 140 | VungleAd ad = getVungleAd(placementReferenceID); 141 | if (ad != null) { 142 | disableButton(ad.playButton); 143 | } 144 | } 145 | @Override 146 | public void onAdViewed(String placementReferenceID) { 147 | Log.d(LOG_TAG, "PlayAdCallback - onAdViewed" + 148 | "\n\tPlacement Reference ID = " + placementReferenceID); 149 | } 150 | 151 | // Deprecated 152 | @Override 153 | public void onAdEnd(final String placementReferenceID, final boolean completed, final boolean isCTAClicked) { 154 | Log.d(LOG_TAG, "PlayAdCallback - onAdEnd" + 155 | "\n\tPlacement Reference ID = " + placementReferenceID + 156 | "\n\tView Completed = " + completed + "" + 157 | "\n\tDownload Clicked = " + isCTAClicked); 158 | } 159 | 160 | @Override 161 | public void onAdEnd(String placementReferenceID) { 162 | Log.d(LOG_TAG, "PlayAdCallback - onAdEnd" + 163 | "\n\tPlacement Reference ID = " + placementReferenceID); 164 | } 165 | 166 | @Override 167 | public void onAdClick(String placementReferenceID) { 168 | Log.d(LOG_TAG, "PlayAdCallback - onAdClick" + 169 | "\n\tPlacement Reference ID = " + placementReferenceID); 170 | } 171 | 172 | @Override 173 | public void onAdRewarded(String placementReferenceID) { 174 | Log.d(LOG_TAG, "PlayAdCallback - onAdRewarded" + 175 | "\n\tPlacement Reference ID = " + placementReferenceID); 176 | } 177 | 178 | @Override 179 | public void onAdLeftApplication(String placementReferenceID) { 180 | Log.d(LOG_TAG, "PlayAdCallback - onAdLeftApplication" + 181 | "\n\tPlacement Reference ID = " + placementReferenceID); 182 | } 183 | 184 | @Override 185 | public void creativeId(String creativeId) { 186 | Log.d(LOG_TAG, "PlayAdCallback - creativeId" + 187 | "\n\tCreative ID = " + creativeId); 188 | } 189 | 190 | @Override 191 | public void onError(final String placementReferenceID, VungleException vungleException) { 192 | Log.d(LOG_TAG, "PlayAdCallback - onError" + 193 | "\n\tPlacement Reference ID = " + placementReferenceID + 194 | "\n\tError = " + vungleException.getLocalizedMessage()); 195 | 196 | makeToast(vungleException.getLocalizedMessage()); 197 | checkInitStatus(vungleException); 198 | } 199 | }; 200 | 201 | private final LoadAdCallback vungleLoadAdCallback = new LoadAdCallback() { 202 | @Override 203 | public void onAdLoad(final String placementReferenceID) { 204 | Log.d(LOG_TAG, "LoadAdCallback - onAdLoad" + 205 | "\n\tPlacement Reference ID = " + placementReferenceID); 206 | 207 | VungleAd ad = getVungleAd(placementReferenceID); 208 | if (ad != null) { 209 | enableButton(ad.playButton); 210 | disableButton(ad.loadButton); 211 | enableButton(ad.bannerListButton); 212 | } 213 | } 214 | 215 | @Override 216 | public void onError(final String placementReferenceID, VungleException vungleException) { 217 | Log.d(LOG_TAG, "LoadAdCallback - onError" + 218 | "\n\tPlacement Reference ID = " + placementReferenceID + 219 | "\n\tError = " + vungleException.getLocalizedMessage()); 220 | 221 | makeToast(vungleException.getLocalizedMessage()); 222 | checkInitStatus(vungleException); 223 | VungleAd ad = getVungleAd(placementReferenceID); 224 | enableButton(ad.loadButton); 225 | } 226 | }; 227 | 228 | private void checkInitStatus(VungleException vungleException) { 229 | try { 230 | VungleException ex = (VungleException) vungleException; 231 | Log.d(LOG_TAG, ex.getExceptionCode() + ""); 232 | 233 | if (ex.getExceptionCode() == VungleException.VUNGLE_NOT_INTIALIZED) { 234 | initSDK(); 235 | } 236 | } catch (ClassCastException cex) { 237 | Log.d(LOG_TAG, cex.getMessage()); 238 | } 239 | } 240 | 241 | private void setVungleAdUi(final VungleAd ad) { 242 | if (Vungle.canPlayAd(ad.placementReferenceId)) { 243 | enableButton(ad.playButton); 244 | } else { 245 | disableButton(ad.playButton); 246 | } 247 | 248 | switch (ad.name) { 249 | case interstitial: 250 | case rewardedVideo: 251 | setFullscreenAd(ad); 252 | break; 253 | case mrec: 254 | setBannerAd(ad, AdConfig.AdSize.VUNGLE_MREC); 255 | break; 256 | case banner: 257 | setBannerAd(ad, AdConfig.AdSize.BANNER); 258 | break; 259 | default: 260 | Log.d(LOG_TAG, "Vungle ad type not recognized"); 261 | break; 262 | } 263 | } 264 | 265 | private void setFullscreenAd(final VungleAd ad) { 266 | ad.loadButton.setOnClickListener(new View.OnClickListener() { 267 | @Override 268 | public void onClick(View view) { 269 | if (Vungle.isInitialized()) { 270 | Vungle.loadAd(ad.placementReferenceId, vungleLoadAdCallback); 271 | 272 | disableButton(ad.loadButton); 273 | } else { 274 | makeToast("Vungle SDK not initialized"); 275 | } 276 | } 277 | }); 278 | 279 | ad.playButton.setOnClickListener(new View.OnClickListener() { 280 | @Override 281 | public void onClick(View view) { 282 | if (Vungle.isInitialized()) { 283 | if (Vungle.canPlayAd(ad.placementReferenceId)) { 284 | final AdConfig adConfig = getAdConfig(); 285 | 286 | Vungle.playAd(ad.placementReferenceId, adConfig, vunglePlayAdCallback); 287 | 288 | enableButton(ad.loadButton); 289 | disableButton(ad.playButton); 290 | } else { 291 | makeToast("Vungle ad not playable for " + ad.placementReferenceId); 292 | } 293 | } else { 294 | makeToast("Vungle SDK not initialized"); 295 | } 296 | } 297 | }); 298 | } 299 | 300 | private void setBannerAd(final VungleAd ad, final AdConfig.AdSize adSize) { 301 | final BannerAdConfig bannerAdConfig = new BannerAdConfig(); 302 | bannerAdConfig.setAdSize(adSize); 303 | bannerAdConfig.setMuted(true); 304 | 305 | ad.loadButton.setOnClickListener(new View.OnClickListener() { 306 | @Override 307 | public void onClick(View view) { 308 | if (Vungle.isInitialized()) { 309 | Banners.loadBanner(ad.placementReferenceId, bannerAdConfig, vungleLoadAdCallback); 310 | 311 | disableButton(ad.loadButton); 312 | } else { 313 | makeToast("Vungle SDK not initialized"); 314 | } 315 | } 316 | }); 317 | 318 | ad.playButton.setOnClickListener(new View.OnClickListener() { 319 | @Override 320 | public void onClick(View view) { 321 | if (Vungle.isInitialized()) { 322 | if (Banners.canPlayAd(ad.placementReferenceId, bannerAdConfig.getAdSize())) { 323 | if (vungleBannerAd != null) { 324 | vungleBannerAd = null; 325 | ad.container.removeAllViews(); 326 | } 327 | 328 | vungleBannerAd = Banners.getBanner(ad.placementReferenceId, bannerAdConfig, vunglePlayAdCallback); 329 | 330 | if (vungleBannerAd != null) { 331 | ad.container.addView(vungleBannerAd); 332 | ad.container.setVisibility(View.VISIBLE); 333 | } 334 | // Button UI 335 | enableButton(ad.loadButton); 336 | disableButton(ad.playButton); 337 | enableButton(ad.pauseResumeButton); 338 | enableButton(ad.closeButton); 339 | 340 | ad.bannerAdPlaying = true; 341 | ad.pauseResumeButton.setText("PAUSE"); 342 | } else { 343 | makeToast("Vungle ad not playable for " + ad.placementReferenceId); 344 | } 345 | } else { 346 | makeToast("Vungle SDK not initialized"); 347 | } 348 | } 349 | }); 350 | 351 | ad.pauseResumeButton.setOnClickListener(new View.OnClickListener() { 352 | @Override 353 | public void onClick(View view) { 354 | ad.bannerAdPlaying = !ad.bannerAdPlaying; 355 | 356 | if (vungleBannerAd != null) { 357 | vungleBannerAd.setAdVisibility(ad.bannerAdPlaying); 358 | } 359 | 360 | ad.pauseResumeButton.setText(ad.bannerAdPlaying ? "PAUSE" : "RESUME"); 361 | } 362 | }); 363 | 364 | ad.closeButton.setOnClickListener(new View.OnClickListener() { 365 | @Override 366 | public void onClick(View view) { 367 | if (vungleBannerAd != null) { 368 | ad.container.removeView(vungleBannerAd); 369 | ad.container.setVisibility(View.GONE); 370 | vungleBannerAd.destroyAd(); 371 | vungleBannerAd = null; 372 | } 373 | 374 | disableButton(ad.pauseResumeButton); 375 | disableButton(ad.closeButton); 376 | } 377 | }); 378 | 379 | if (ad.bannerListButton != null) { 380 | ad.bannerListButton.setOnClickListener(new View.OnClickListener() { 381 | @Override 382 | public void onClick(View v) { 383 | startActivity(BannerListActivity.getIntent(MainActivity.this, ad.placementReferenceId)); 384 | } 385 | }); 386 | } 387 | 388 | if (ad.bannerMultipleButton != null) { 389 | ad.bannerMultipleButton.setOnClickListener(new View.OnClickListener() { 390 | @Override 391 | public void onClick(View v) { 392 | startActivity(BannerMultipleActivity.getIntent(MainActivity.this)); 393 | } 394 | }); 395 | } 396 | } 397 | 398 | private AdConfig getAdConfig() { 399 | AdConfig adConfig = new AdConfig(); 400 | 401 | adConfig.setAdOrientation(AdConfig.MATCH_VIDEO); 402 | adConfig.setMuted(false); 403 | 404 | return adConfig; 405 | } 406 | 407 | private void setCustomRewardedFields() { 408 | Vungle.setIncentivizedFields("TestUser", "RewardTitle", "RewardedBody", "RewardedKeepWatching", "RewardedClose"); 409 | } 410 | 411 | 412 | private void initUiElements() { 413 | Log.d(LOG_TAG, "initUiElements"); 414 | 415 | TextView text_app_id = (TextView) findViewById(R.id.text_app_id); 416 | text_app_id.setText("App ID - " + getString(R.string.app_id)); 417 | 418 | Log.d(LOG_TAG, "!!!VungleAd Test Begins!!!"); 419 | 420 | for (VungleAd vungleAd : vungleAds) { 421 | setVungleAdUi(vungleAd); 422 | } 423 | } 424 | 425 | private VungleAd getVungleAd(String placementReferenceId) { 426 | for (VungleAd vungleAd : vungleAds) { 427 | if (vungleAd.placementReferenceId.equals(placementReferenceId)) { 428 | return vungleAd; 429 | } 430 | } 431 | return null; 432 | } 433 | 434 | private void enableButton(final Button button) { 435 | if (button == null) { return; } 436 | runOnUiThread(new Runnable() { 437 | @Override 438 | public void run() { 439 | button.setEnabled(true); 440 | button.setAlpha(1.0f); 441 | } 442 | }); 443 | } 444 | 445 | private void disableButton(final Button button) { 446 | if (button == null) { return; } 447 | runOnUiThread(new Runnable() { 448 | @Override 449 | public void run() { 450 | button.setEnabled(false); 451 | button.setAlpha(0.5f); 452 | } 453 | }); 454 | } 455 | 456 | private void makeToast(String message) { 457 | Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); 458 | } 459 | 460 | private class VungleAd { 461 | @NonNull private final String name; 462 | @NonNull private final String placementReferenceId; 463 | @NonNull private final TextView titleTextView; 464 | @NonNull private final Button loadButton; 465 | @NonNull private final Button playButton; 466 | @Nullable private final Button pauseResumeButton; 467 | @Nullable private final Button closeButton; 468 | @Nullable private final FrameLayout container; 469 | @Nullable private final Button bannerListButton; 470 | @Nullable private final Button bannerMultipleButton; 471 | @NonNull private boolean bannerAdPlaying; 472 | 473 | private VungleAd(String name) { 474 | this.name = name; 475 | this.placementReferenceId = getPlacementReferenceId(); 476 | this.titleTextView = getTextView(); 477 | this.loadButton = getLoadButton(); 478 | this.playButton = getPlayButton(); 479 | this.pauseResumeButton = getPauseResumeButton(); 480 | this.closeButton = getCloseButton(); 481 | this.bannerListButton = getBannerListButton(); 482 | this.bannerMultipleButton = getBannerMultipleButton(); 483 | this.container = getContainer(); 484 | this.bannerAdPlaying = false; 485 | } 486 | 487 | private String getPlacementReferenceId() { 488 | int stringId = getResources().getIdentifier("placement_id_" + name, "string", PACKAGE_NAME); 489 | return getString(stringId); 490 | } 491 | 492 | private TextView getTextView() { 493 | int textViewId = getResources().getIdentifier("tv_" + name, "id", PACKAGE_NAME); 494 | String textViewString = getString(getResources().getIdentifier("title_" + name, "string", PACKAGE_NAME)); 495 | TextView tv = (TextView) findViewById(textViewId); 496 | tv.setText(textViewString + " - " + placementReferenceId); 497 | return tv; 498 | } 499 | 500 | private Button getLoadButton() { 501 | int buttonId = getResources().getIdentifier("btn_load_" + name, "id", PACKAGE_NAME); 502 | Button button = (Button) findViewById(buttonId); 503 | disableButton(button); 504 | return button; 505 | } 506 | 507 | private Button getPlayButton() { 508 | int buttonId = getResources().getIdentifier("btn_play_" + name, "id", PACKAGE_NAME); 509 | Button button = (Button) findViewById(buttonId); 510 | disableButton(button); 511 | return button; 512 | } 513 | 514 | private Button getPauseResumeButton() { 515 | int buttonId = getResources().getIdentifier("btn_pause_resume_" + name, "id", PACKAGE_NAME); 516 | Button button = (Button) findViewById(buttonId); 517 | if (button != null) { 518 | return button; 519 | } 520 | return null; 521 | } 522 | 523 | private Button getCloseButton() { 524 | int buttonId = getResources().getIdentifier("btn_close_" + name, "id", PACKAGE_NAME); 525 | Button button = (Button) findViewById(buttonId); 526 | if (button != null) { 527 | return button; 528 | } 529 | return null; 530 | } 531 | 532 | private FrameLayout getContainer() { 533 | int containerId = getResources().getIdentifier("container_" + name, "id", PACKAGE_NAME); 534 | FrameLayout container = (FrameLayout) findViewById(containerId); 535 | if (container != null) { 536 | return container; 537 | } 538 | return null; 539 | } 540 | 541 | private Button getBannerListButton() { 542 | int buttonId = getResources().getIdentifier("btn_list_" + name, "id", PACKAGE_NAME); 543 | Button button = (Button) findViewById(buttonId); 544 | if (button != null) { 545 | return button; 546 | } 547 | return null; 548 | } 549 | 550 | private Button getBannerMultipleButton() { 551 | int buttonId = getResources().getIdentifier("btn_multiple_" + name, "id", PACKAGE_NAME); 552 | Button button = (Button) findViewById(buttonId); 553 | if (button != null) { 554 | return button; 555 | } 556 | return null; 557 | } 558 | } 559 | } -------------------------------------------------------------------------------- /app/src/main/java/com/publisher/sample/VungleBannerAdAdapter.java: -------------------------------------------------------------------------------- 1 | package com.publisher.sample; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.annotation.Nullable; 5 | import androidx.recyclerview.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.vungle.warren.AdConfig; 11 | import com.vungle.warren.Banners; 12 | import com.vungle.warren.LoadAdCallback; 13 | import com.vungle.warren.PlayAdCallback; 14 | import com.vungle.warren.VungleBanner; 15 | import com.vungle.warren.error.VungleException; 16 | 17 | public class VungleBannerAdAdapter extends RecyclerView.Adapter { 18 | private static final int BANNED_AD_TYPE = R.layout.ad_item; 19 | private final String placementId; 20 | private final int adPosition; 21 | private final RecyclerView.Adapter originalAdapter; 22 | private final PlayAdCallback playAdCallback; 23 | private VungleBanner ad; 24 | private boolean destroyed; 25 | 26 | public VungleBannerAdAdapter(@NonNull String placementId, 27 | int adPosition, 28 | @NonNull RecyclerView.Adapter originalAdapter, 29 | @Nullable PlayAdCallback playAdCallback) { 30 | this.placementId = placementId; 31 | this.adPosition = adPosition; 32 | this.originalAdapter = originalAdapter; 33 | this.playAdCallback = playAdCallback; 34 | } 35 | 36 | @NonNull 37 | @Override 38 | public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int type) { 39 | if (type == BANNED_AD_TYPE) { 40 | View view = LayoutInflater.from(viewGroup.getContext()).inflate(type, viewGroup, false); 41 | return new OneAdHolder(view); 42 | } 43 | return originalAdapter.onCreateViewHolder(viewGroup, type); 44 | } 45 | 46 | @Override 47 | public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { 48 | if (holder.getItemViewType() == BANNED_AD_TYPE) { 49 | ((OneAdHolder) holder).bind(placementId); 50 | } else { 51 | //noinspection unchecked 52 | originalAdapter.onBindViewHolder(holder, position < adPosition ? position : position - 1); 53 | } 54 | } 55 | 56 | @Override 57 | public int getItemCount() { 58 | return 1 + originalAdapter.getItemCount(); 59 | } 60 | 61 | @Override 62 | public int getItemViewType(int position) { 63 | if (position == adPosition) { 64 | return BANNED_AD_TYPE; 65 | } else { 66 | return position < adPosition ? 67 | originalAdapter.getItemViewType(position) : 68 | originalAdapter.getItemViewType(position + 1); 69 | } 70 | } 71 | 72 | //must be called 73 | public void destroy() { 74 | destroyed = true; 75 | if (ad != null) { 76 | ad.destroyAd(); 77 | } 78 | } 79 | 80 | private boolean canStart() { 81 | return ad == null && !destroyed; 82 | } 83 | 84 | private class OneAdHolder extends RecyclerView.ViewHolder { 85 | private final ViewGroup viewGroup; 86 | 87 | OneAdHolder(@NonNull View itemView) { 88 | super(itemView); 89 | viewGroup = itemView.findViewById(R.id.ad_container); 90 | } 91 | 92 | void bind(final String placement) { 93 | if (canStart()) { 94 | final AdConfig.AdSize size = AdConfig.AdSize.BANNER; 95 | Banners.loadBanner(placement, size, new LoadAdCallback() { 96 | @Override 97 | public void onAdLoad(String s) { 98 | if (canStart()) { 99 | ad = Banners.getBanner(placement, size, playAdCallback); 100 | if (ad != null) { 101 | ad.disableLifeCycleManagement(true); 102 | viewGroup.addView(ad); 103 | ad.renderAd(); 104 | } 105 | } 106 | } 107 | 108 | @Override 109 | public void onError(String s, VungleException e) { 110 | } 111 | }); 112 | } 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/aqua_button_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/aqua_button_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/aqua_button_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/v_expression_splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/src/main/res/drawable/v_expression_splash.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/vungle_logo_aqua_mango.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/src/main/res/drawable/vungle_logo_aqua_mango.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/vungle_logo_aqua_mango_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vungle/Android-SDK/ec4cfa32c841646f9184d551157377eac89027aa/app/src/main/res/drawable/vungle_logo_aqua_mango_banner.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_banner_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_banner_multiple.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 20 | 21 | 30 | 31 | 39 | 40 | 50 | 51 |