Giter VIP home page Giter VIP logo

adcolony-unity-plugin's Introduction

License progress contributions
Unity Version Android Version iOS Version

AdColony SDK Unity Plugin

Requirements

Overview

AdColony delivers zero-buffering, full-screen Instant-Play™ HD video, interactive Aurora™ Video, and Aurora™ Playable ads that can be displayed anywhere within your application. Our advertising SDK is trusted by the world’s top gaming and non-gaming publishers, delivering them the highest monetization opportunities from brand and performance advertisers. AdColony’s SDK can monetize a wide range of ad formats including in-stream/pre-roll, out-stream/interstitial and V4VC™, a secure system for rewarding users of your app with virtual currency upon the completion of video and playable ads.

Release Notes

v4.4.0.0 (2020/09/28)

  • Updated to AdColony SDK 4.4.0(iOS).

v4.3.2.0 (2020/09/16)

  • Fixed build issue for unity v2019 and greater.
  • Updated to AdColony SDK 4.2.4(Android).

v4.3.1.0 (2020/08/27)

  • Updated to AdColony SDK 4.3.1 (iOS) and 4.2.2 (Android).

v4.2.0.0 (2020/07/17)

  • Updated to AdColony SDK 4.2.0 (iOS) and 4.2.0 (Android).

v4.1.5.0 (2020/05/28)

  • Updated to AdColony SDK 4.1.5 (iOS) and 4.1.4 (Android).

v4.1.3.0 (2020/02/13)

  • Updated to AdColony SDK 4.1.3 (iOS) and 4.1.3 (Android).
  • Added show and hide APIs for banner ad.
  • Added destroy ad API for Interstitial ad.

v4.1.2.0 (2019/10/24)

  • Updated to AdColony SDK 4.1.2 (iOS).
  • Fixed NPE crash issue in android plugin.

v4.1.1 (2019/10/09)

  • Updated to AdColony SDK 4.1.1 (iOS).

v4.1.0 (2019/09/27)

  • Updated to AdColony SDK 4.1.0 (iOS/Android).
  • Added support for banners.

v3.3.11 (2019/07/15)

  • Updated to AdColony SDK 3.3.11 (Android)
  • [Android] Fixed ConcurrentModificationException that was exposed with a server-side update.
  • [Android] Fixed an issue related to partial downloads that potentially caused AdColony to become disabled.

v3.3.10 (2019/06/12)

  • Updated to AdColony SDK 3.3.8.1 (iOS) and 3.3.10 (Android)
  • [iOS] Fixed a bug where click action for some of the ads was not working.
  • [Android] Improved WebView behavior for duties previously handled by our shared object libraries.

v3.3.9 (2019/03/20)

  • Updated to AdColony SDK 3.3.9 (Android)
  • [Android] Fixed NullPointerException that stopped ads from being served on Android Lollipop devices with the 3.3.7 and 3.3.8 SDKs.

v3.3.8 (01/25/2019)

  • Updated to AdColony SDK 3.3.7 (iOS) and 3.3.8 (Android)
  • [iOS] Fixed a CPU watchdog transgression.
  • [iOS] Fixed a memory leak that could cause UIView objects to stay in memory past their lifetime.
  • [iOS] Added advanced logging for inconsistent view controller orientations.
  • [iOS] Several other bug fixes and stability improvements.
  • [Android] Handled RuntimeExceptions that can occur during WebView initialization if the device reports that it is missing the WebView package.

v3.3.7 (12/06/2018)

  • Updated to AdColony SDK 3.3.7 (Android)
  • [Android] Significant stability improvements related to memory consumption.
  • [Android] Reduced ad request response times.
  • [Android] Removed shared object (.so) libraries, reducing the size of our SDK distribution by 94% in the process, as well as addressing issues #25, #33, and #38.

v3.3.6 (11/19/2018)

  • Updated to AdColony SDK 3.3.6 (iOS/Android)
  • Several bug fixes and stability improvements.
  • [iOS] Added support for silencing audio with the Ringer/Silent switch. This is configurable on the clients.adcolony.com dashboard.
  • [iOS] Audio session will not activate until an ad plays.
  • [Android] Added additional configure() signatures that accept an Application context instead of Activity.
  • [Android] Deprecated AdColonyAdViewActivity, AdColonyNativeAdView, and onAudioStarted/onAudioStopped() callbacks.
  • [Android] Handle API level 28 changes for default cleartext traffic behavior.

v3.3.5 (7/18/2018)

  • Officially open sourced Unity plugin
  • Updated to AdColony SDK 3.3.5 (iOS/Android)
  • Several bug fixes and stability improvements.
  • [iOS] Removed requirement for the camera and calendar permissions. However, with these permissions enabled, you may be able to receive higher paying ads.
  • [Android] Fixed RejectedExecutionException in issue #37.
  • [Android] Made Android SDK changes needed to fix the Unity OnConfigurationCompleted callback issue in #35.

v3.3.4 (5/25/2018)

  • Updated to AdColony SDK 3.3.4 (iOS/Android)
  • [iOS] Fixed a bug where advertisement video's close button was not easily tappable because of the status bar overlapping.
  • [iOS] Fixed a bug where unsafe access to the device's battery level was causing a crash mentioned in iOS SDK issue #49.
  • [Android] Fixed new NullPointerException mentioned in Android SDK issue #29.
  • [Unity] Added a new API to pass user consent as required for compliance with the European Union's General Data Protection Regulation (GDPR). If you are collecting consent from your users, you can make use of this new API to inform AdColony and all downstream consumers of the consent. Please see our GDPR FAQ for more information and our GDPR wiki for implementation details.
  • [Unity] Removed symbolic links from within native SDK
  • [Unity] Fixed missing zone ID in some log statements
  • [Unity] Fixed exception during OnRequestInterstitialFailed callback mentioned in Unity Plugin issue #42
  • [All] Several bug fixes and stability improvements.

See the full release notes for more details.

How to Build

The Unity plugin requires both the native iOS and Android SDK repositories in the Plugin/src/sdks directory. You can pull them down using the following commands:

cd Plugin/src/sdks
git clone https://github.com/AdColony/AdColony-Android-SDK.git
git clone https://github.com/AdColony/AdColony-iOS-SDK.git

To build the plugin, use the makefile from the Plugin folder:

cd Plugin
make

Included in this repository is a sample application you can use during your testing.

Getting Started

Retrieve AdColony App and Zone Ids

Log into clients.adcolony.com. If you have not already done so, create an app and needed zones on the website. To create new apps and video zones, locate the green buttons on the right-hand side of the Publisher section. Retrieve your app ID and your corresponding zone IDs from the AdColony website and make note of them for later use. Please reference the screenshots below on locations of the app ID and zone IDs.

Get app ID

Click on the zone link at the bottom of the page to bring up the zone details.

Get zone ID

In this case, the app id, app4c2e4129ea7ce, and zone id, z4c2e422e48151 should be used to initialize the app and display ads within your project.

Installation

  1. In the Unity Editor, select "Assets"->"Import Package"->"Custom Package". Navigate to the location of the AdColony SDK Unity Plugin and select "AdColony.unitypackage".

    Import Package

  2. Select "Import" to import all the assets into your project.

    Import Package

  3. The AdColony SDK Unity Plugin includes Google's PlayServicesResolver to automatically pull in necessary Google Play Services libraries. If there are conflicts with this, the play-services-ads library is the only required. You can choose to ignore this PlayServicesResolver installation, remove the AdColony/Editor/ADCDependencies.cs file, and include the play-services-ads in another way.

  4. The Plugins/Android/AdColony/AndroidManifest.xml file is automatically generated. To update manually, select "Tools"->"AdColony"->"Update AndroidManifest.xml".

Upgrading from SDK 3.0.x:

In order to support thin/fat Android builds, we moved the native .so files from the Plugins/Android/AdColony/libs folder to the Plugins/Android/libs folder. Removing the Plugins/Android/AdColony/libs folder before importing is recommended.

Upgrading from SDK 2.x:

Please note that updating from our 2.x Unity Plugin is not a drag and drop update, but rather includes breaking API and process changes. In order to take advantage of the 3.x Unity Plugin, please remove the older plugin before installing.

Showing Ads

The basics of using the AdColony SDK to serve ads to your users are:

Configure AdColony

The first step is to configure the AdColony SDK:

    string[] zoneIds = new string[] { "zone_id_1", "zone_id_2" };
    AdColony.Ads.Configure(APP_ID, null, zoneIds);

You can configure the service more than once without any performance impact. If the service is already initialized with the same options and zones, the attempt will be ignored.

See the API documentation on how to use the AppOptions.

Showing Banner Ads

  1. Register for callbacks

    After successful configuration of AdColony SDK, you need to register banner callbacks such as:

    • OnAdViewLoaded - Called when ad view has been loaded.
    • OnAdViewFailedToLoad - Called when ad view failed to load.

    For a complete listing of callbacks see AdColony.cs.

    AdColony.AdColonyAdView adView;
    
    AdColony.Ads.OnAdViewLoaded += (AdColony.AdColonyAdView ad) => {
        adView = ad;
    };
    
    AdColony.Ads.OnAdViewFailedToLoad += (AdColony.AdColonyAdView ad) => {
        Debug.Log("Banner ad failed to load");
    };
  2. Request Banner Ad

    AdColony.Ads.RequestAdView("zone_id_1", AdColony.AdSize.Banner, adOptions);
  3. Additional APIs to show and hide Banner Ad

//Show the ad view.
adView.ShowAdView();

//Hide the ad view.
adView.HideAdView();
  1. Clean up Banner Ad: When AdColony.AdColonyAdView is no longer used, make sure to call DestroyAdView() method to avoid memory leaks. On the invocation of this method, the plugin will clean up memory occupied by this object:
    adView.DestroyAdView();

Showing Interstitial Ads

  1. Register for callbacks

    After successful configuration of AdColony SDK, you will also want to register for important service callbacks such as:

    • OnRequestInterstitial - Called when a requested ad is ready to be shown
    • OnExpiring - Called when an ad has expired (typically after 30-60 min), we suggest using this callback to request a new ad
    • OnRewardGranted - Called when user has completed a video from a rewarded video zone

    For a complete listing of callbacks see AdColony.cs.

    AdColony.InterstitialAd _ad = null;
    
    AdColony.Ads.OnRequestInterstitial += (AdColony.InterstitialAd ad) => {
        _ad = ad;
    };
    
    AdColony.Ads.OnExpiring += (AdColony.InterstitialAd ad) => {
        AdColony.Ads.RequestInterstitialAd(ad.ZoneId, null);
    };
  2. Request an Interstitial Ad

    AdColony.Ads.RequestInterstitialAd("zone_id_1", null);
  3. Show the Interstitial Ad

    if (_ad != null) {
        AdColony.Ads.ShowAd(_ad);
    }
  4. Clean up Interstitial Ad: When AdColony.InterstitialAd is no longer used, make sure to call DestroyAd() method to avoid memory leaks. On the invocation of this method, the plugin will clean up memory occupied by this object.

    interstitial.DestroyAd();

Showing Rewarded Interstitial Ads

Showing a rewarded video ad is very much like showing an interstital video ad. There are two subtle differences:

  1. You can optionally show system alerts informing the user they are about to or have received an award using the ad options ShowPrePopup and ShowPostPopup.

    AdColony.AdOptions adOptions = new AdColony.AdOptions();
    adOptions.ShowPrePopup = true;
    adOptions.ShowPostPopup = true;
    
    AdColony.Ads.RequestInterstitialAd("zone_id_1", adOptions);
  2. If the ad comes from a zone set as rewarded from the developer portal, the OnRewardGranted event will be called after the user watches the ad. Within this callback is when the reward should then be granted to the user. If you have enabled server-to-server callbacks, this is when you should download new state from your server.

    AdColony.Ads.OnRewardGranted += (string zoneId, bool success, string name, int amount) => {
        // Grant the reward to the user, or
        // request new state from the game server if using server-to-server callbacks
    };

To set your zone to a rewarded interstitial zone on the portal, select the following zone type:

Get zone ID

Gradle Integration

Unity introduced the Gradle build system for Android in Unity 5.5. This document outlines the setup required to use AdColony with Gradle in your Unity package.

Add the following to your build.gradle file:

android {
  /** Any other configurations here */
  sourceSets {
    main {
      jniLibs.srcDirs = ['libs']
    }
  }
}

If using Proguard, add the following to your Proguard configuration:

# For communication with AdColony's WebView
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

# Keep ADCNative class members unobfuscated
-keepclassmembers class com.adcolony.sdk.ADCNative** {
    *;
 }

Note: for more details on the AdColony Android setup, please refer to AdColony Android Project Setup.

GDPR

In compliance with the European Union's General Data Protection Regulation (GDPR), if you are collecting consent from your users, you can make use of APIs discussed below to inform AdColony and all downstream consumers of this information. Please see our GDPR FAQ for more information.

Passing Consent via AppOptions

In the Android SDK v4.2, we've modified the existing methods available to our AdColonyAppOptions API for additional support in GDPR compliance. We’ve also added support for version 2.0 of the IAB Transparency and Consent Framework (TCF).

We require the GDPR consent string to have a value of "1" or "0". A value of "1" implies the user has given consent to store and process personal information and a value of "0" means the user has declined consent.

Example Code

AdColony.AppOptions appOptions = new AdColony.AppOptions();

// The value passed via setPrivacyFrameworkRequired() will determine the GDPR requirement of
// the user. If it's set to true, the user is subject to the GDPR laws.
appOptions.SetPrivacyFrameworkRequired(AdColony.AppOptions.GDPR, true);

// Your user's consent String. In this case, the user has given consent to store
// and process personal information. This value may be either O, 1, or an IAB consent string.
appOptions.SetPrivacyConsentString(AdColony.AppOptions.GDPR, "1");

AdColony.Ads.Configure(APP_ID, appOptions, ZONE_IDS);

CCPA

This documentation is provided for compliance with the California Consumer Privacy Act (CCPA). In order to pass CCPA opt-outs from your users, you should make use of the APIs discussed below to inform AdColony and all downstream consumers of this information. Please see our CCPA FAQ for more information.

Passing Consent via AppOptions

In the Android SDK v4.2, we added generic privacy methods to our AdColonyAppOptions API for additional support in CCPA compliance. To successfully pass us an opt-out signal, the publisher will need to provide AdColony a signal to indicate whether CCPA legislation is applicable to the user in addition to the actual consent value.

A value of "1" or "0" A value of "1" implies the user has not opted-out to the sale of their data, as defined by the CCPA, and AdColony should continue with our standard processing of user information. A value of "0" means the user has opted-out to the sale of their data.

Example Code

AdColony.AppOptions appOptions = new AdColony.AppOptions();

// The value passed via setPrivacyFrameworkRequired() will indicate to AdColony whether CCPA is applicable legislation for the user.
// If it's set to true, the user is subject to the CCPA. Note that IAB US Privacy String has information embedded into the string to
// indicate whether CCPA is applicable. In the event of conflicting signals between the IAB US Privacy String and setPrivacyFrameworkRequired(),
// we will interpret as CCPA being applicable.
appOptions.SetPrivacyFrameworkRequired(AdColony.AppOptions.CCPA, true);

// Your user's consent string.
// In this case, the user has not opted-out to the sale of their information.
appOptions.SetPrivacyConsentString(AdColony.AppOptions.CCPA, "1");

AdColony.Ads.Configure(APP_ID, appOptions, ZONE_IDS);

COPPA

This documentation is provided for additional compliance with the Children’s Online Privacy Protection Act (COPPA). Publishers may designate all inventory within their applications as being child-directed or as COPPA-applicable though our UI. Publishers who have knowledge of specific individuals as being COPPA-applicable should make use of the API discussed below to inform AdColony and all downstream consumers of this information. Please see our privacy policy for more information regarding AdColony and COPPA.

Passing Consent via AppOptions

In the Android SDK v4.2, we added generic privacy methods to our AdColonyAppOptions API to designate specific users as being COPPA-applicable.

Example Code

AdColony.AppOptions appOptions = new AdColony.AppOptions();

// The value passed via setPrivacyFrameworkRequired() will determine whether COPPA is applicable for the user.
// If it's set to true, AdColony will behave with the understanding COPPA is applicable for the user.
appOptions.SetPrivacyFrameworkRequired(AdColony.AppOptions.COPPA, true);

AdColony.Ads.Configure(APP_ID, appOptions, ZONE_IDS);

Legal Requirements

By downloading the AdColony SDK, you are granted a limited, non-commercial license to use and review the SDK solely for evaluation purposes. If you wish to integrate the SDK into any commercial applications, you must register an account with AdColony and accept the terms and conditions on the AdColony website.

Note that U.S. based companies will need to complete the W-9 form and send it to us before publisher payments can be issued.

Contact Us

For more information, please visit AdColony.com. For questions or assistance, please email us at [email protected].

License

AdColony SDK Unity Plugin is available under the Apache 2.0 license. See the LICENSE file for more info.



Made with ❤️ in Seattle and Dallas
AdColony Logo

adcolony-unity-plugin's People

Contributors

akwkong avatar edencakir avatar mahesh-kokate avatar rajeshadc avatar shawnkc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.