Unity android integration - OutbidIO/Outbid-SDK GitHub Wiki

Setting up your project

Prequisities

  • Unity 4 and above
  • Google play services included in the project Admob plugin

Import outbid plugin

  • Download outbid unity package
  • Import the package into your project

Right click on your project Assets folder and click “import package” -> “Custom Package” Navigate to the downloaded “outbid.unityPackage” and click it

Make sure all files are selected and click import

AndroidManifest.xml:

Add the following permissions under the manifast tag (if they dont exist):

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

sdk initialization

  • navigate to your project Assets\Plugins\outbid folder and drag and drop “Outbid.prefab” to your project hierarchy tab of your app first scene

The prefab will initiallize the outbid sdk

  • Click on the “Outbid.prefab” file and insert the developrId and appId provided to you

Make sure you change the defualt “0” values to your real developer and app ids

Interstitial ads:

Preload interstitial:

If you display interstitial ads in your app add this line after app start - this will Cache ads for later use:

Outbid.loadInterstitial ();

you only have to call this once, ads will cache automatically from this point on

To actually display interstitial use this call:

if (Outbid.isInterstitalAvailable ())
      Outbid.showInterstitial ();

Outbid.isInterstitalAvailable return true if ad is available for display

(Optional) Interstitial callbacks:

You can set which object of your unity project will receive callbacks regarding interstitial ad load and presentation. if you dont set the object “Outbid” object will receive the callbacks and they will be catched by the “outbid.cs” script

set object to receive interstitial callbacks

Outbid.setInterstitialListener ("objectName");

Add this methods to the selected object attached script in order to catch the events:

public void onInterstitialLoaded()
       Debug.Log (" outbid | onInterstitialLoaded");

// called when ad is opened
public void onInterstitialOpen()
       Debug.Log (" outbid | onInterstitialOpen");

// called when ad failed to load. reason for failure 0 - no network connection, 1 - no fill, 2 - internal error
public void onInterstitialFailedToLoad(int reason)
       Debug.Log (" outbid | onInterstitialFailedToLoad " + reason);

// called when ad is closed
public void onInterstitialClosed()
       Debug.Log (" outbid | onInterstitialClosed");

Banner ads:

To show a banner call this:

// The method param indicate where should the banner appear on screen
Outbid.showBanner (OutbidBannerPositions.BOTTOM);

You can add second param which indicate which banner size to show:

Outbid.showBanner(OutbidBannerPositions.BOTTOM,OutbidBannerSizes.BANNER);

In order to hide the banner call:

Outbid.hideBanner();

(Optional) banner callbacks:

// set object to receive banner callbacks

Outbid.setBannerListener ("objectName");
//called when banner is loaded and displayed on screen
public void onBannerLoaded()
	Debug.Log (" outbid | onBannerLoaded");

// called when banner failed to load
public void onBannerFailedToLoad(int reason)
        Debug.Log (" outbid | onBannerFailedToLoad " + reason);

Monitor outbid flow:

You can filter the log cat with “outbid” tag in order to monitor for sdk integration status and possible errors.