Getting started

This guide will walk you through the steps to integrate the bidapp SDK into your Unity project, enabling you to monetize your applications with ads effectively.

Import the Plugin into Unity

To integrate the Bidapp Unity plugin you need to take the following step:

1. In Unity, select Assets > Import Package > Custom Package… 2. Choose the Unity Plugin file you downloaded. 3. In the Import Unity Package dialog, click Import

The plugin requires Unity 2022.x.x or later.

Choose ad networks

To select ad networks to use with the Bidapp mediation you should edit the ./BidappAds/Assets/BidappAds/Editor/Dependencies.xml file in your project. Comment out all of the unwanted ad networks inside the iosPods section and save the file:

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
    </androidPackages>
	<iosPods>
		<iosPod name="bidapp" addToAllTargets="false" />
		<!--iosPod name="bidapp/Applovin" addToAllTargets="false" /-->
		<iosPod name="bidapp/ApplovinMax" addToAllTargets="false" />
		<!--iosPod name="bidapp/Unity" addToAllTargets="false" /-->
		<iosPod name="bidapp/Liftoff" addToAllTargets="false" />
		<iosPod name="bidapp/Chartboost" addToAllTargets="false" />
		<!--iosPod name="bidapp/AdMob" addToAllTargets="false" /-->
	</iosPods>
</dependencies>

Get the pubid string

Request pubid by sending email to connect@bidapp.io

Initialize the SDK

Initialize the SDK and set the SDK delegate to receive events in the Start() method of your class by the following code:

using UnityEngine;
using System;
using Bidapp;

public class DemoGUI : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        var sdkDelegate = BidappSDKDelegate.CreateInstance(this);

        sdkDelegate.OnInterstitialDidLoadAd += (interstitialIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnInterstitialDidLoadAd: interstitialId {0}, providerId: {1}", interstitialIdentifier, providerId));
        sdkDelegate.OnInterstitialDidFailToLoadAd += (interstitialIdentifier, providerId, errorDescription) => Debug.Log(String.Format("BIDUnity OnInterstitialDidFailToLoadAd: interstitialId {0}, providerId: {1}, errorDescription: {2}", interstitialIdentifier, providerId, errorDescription));
        sdkDelegate.OnInterstitialDidDisplayAd += (interstitialIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnInterstitialDidDisplayAd: interstitialId {0}, providerId: {1}", interstitialIdentifier, providerId));
        sdkDelegate.OnInterstitialDidClickAd += (interstitialIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnInterstitialDidClickAd: interstitialId {0}, providerId: {1}", interstitialIdentifier, providerId));
        sdkDelegate.OnInterstitialDidHideAd += (interstitialIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnInterstitialDidHideAd: interstitialId {0}, providerId: {1}", interstitialIdentifier, providerId));
        sdkDelegate.OnInterstitialDidFailToDisplayAd += (interstitialIdentifier, providerId, errorDescription) => Debug.Log(String.Format("BIDUnity OnInterstitialDidFailToDisplayAd: interstitialId {0}, providerId: {1}, errorDescription: {2}", interstitialIdentifier, providerId, errorDescription));
        sdkDelegate.OnInterstitialAllNetworksFailedToDisplayAd += (interstitialIdentifier) => Debug.Log(String.Format("BIDUnity OnInterstitialAllNetworksFailedToDisplayAd: interstitialId {0}, providerId: {1}", interstitialIdentifier));

        sdkDelegate.OnRewardedDidLoadAd += (rewardedIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnRewardedDidLoadAd: rewardedId {0}, providerId: {1}", rewardedIdentifier, providerId));
        sdkDelegate.OnRewardedDidFailToLoadAd += (rewardedIdentifier, providerId, errorDescription) => Debug.Log(String.Format("BIDUnity OnRewardedDidFailToLoadAd: interstitialId {0}, providerId: {1}, errorDescription: {2}", rewardedIdentifier, providerId, errorDescription));
        sdkDelegate.OnRewardedDidDisplayAd += (rewardedIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnRewardedDidDisplayAd: rewardedId {0}, providerId: {1}", rewardedIdentifier, providerId));
        sdkDelegate.OnRewardedDidClickAd += (rewardedIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnRewardedDidClickAd: rewardedId {0}, providerId: {1}", rewardedIdentifier, providerId));
        sdkDelegate.OnRewardedDidHideAd += (rewardedIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnRewardedDidHideAd: rewardedId {0}, providerId: {1}", rewardedIdentifier, providerId));
        sdkDelegate.OnRewardedDidFailToDisplayAd += (rewardedIdentifier, providerId, errorDescription) => Debug.Log(String.Format("BIDUnity OnRewardedDidDisplayAd: interstitialId {0}, providerId: {1}, errorDescription: {2}", rewardedIdentifier, providerId, errorDescription));
        sdkDelegate.OnRewardedAllNetworksFailedToDisplayAd += (rewardedIdentifier) => Debug.Log(String.Format("BIDUnity OnRewardedAllNetworksFailedToDisplayAd: rewardedId {0}", rewardedIdentifier));
        sdkDelegate.OnUserDidReceiveReward += (rewardedIdentifier) => Debug.Log(String.Format("BIDUnity OnUserDidReceiveReward: rewardedId {0}", rewardedIdentifier));

        sdkDelegate.OnBannerDidDisplayAd += (bannerIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnBannerDidDisplayAd: bannerId {0}, providerId: {1}", bannerIdentifier, providerId));
        sdkDelegate.OnBannerFailedToDisplayAd += (bannerIdentifier, providerId, errorDescription) => Debug.Log(String.Format("BIDUnity OnBannerDidDisplayAd: bannerId {0}, providerId: {1}, errorDescription: {2}", bannerIdentifier, providerId, errorDescription));
        sdkDelegate.OnBannerClicked += (bannerIdentifier, providerId) => Debug.Log(String.Format("BIDUnity OnBannerClicked: bannerId {0}, providerId: {1}", bannerIdentifier, providerId));
        sdkDelegate.OnBannerAllNetworksFailedToDisplayAd += (bannerIdentifier) => Debug.Log(String.Format("BIDUnity OnBannerAllNetworksFailedToDisplayAd: bannerId {0}", bannerIdentifier));

        BidappBinding.Instance.SetCallbacks(sdkDelegate);
        
       //BidappBinding.Instance.SetLogging(true);//Uncomment if you need debug logs

        string adContentType = BidappContentType.Interstitial + BidappContentType.Banner + BidappContentType.Rewarded;

        string pubid = "";

#if UNITY_ANDROID
		pubid = "15ddd248-7acc-46ce-a6fd-e6f6543d22cd";
#endif

#if UNITY_IOS || UNITY_IPHONE
		pubid = "15ddd248-7acc-46ce-a6fd-e6f6543d22cd";
#endif
        //BidappBinding.Instance.setTestMode(true);//Uncomment if you need test mode

        BidappBinding.Instance.RequestTrackingAuthorization();
        
        BidappBinding.Instance.Start(pubid, adContentType);

        Debug.Log("Started with pubid = " + pubid);
    }

    ....
}

Uncomment the "//BidappBinding.Instance.SetLogging(true);" code to enable debug logs.

Uncomment the "//BidappBinding.Instance.setTestMode(true);" code to enable test mode.

Pay attention to the pubid string obtained earlier at Get the pubid string of this instruction.

Last updated