Hi,
How to integrate Leadbolt ads into Unity project?
I have downloaded Leadbolt SDK and placed pubxapp.jar and pubxappCom.jar into Plugins/Android.
This is my LeadboltIntegration.cs file:
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
using System;
public class LeadboltIntegration : MonoBehaviour
{
public string id;
static AndroidJavaObject adController;
void Start ()
{
Invoke ("Initialize",3);
Invoke ("LoadAd",5);
}
void Initialize ()
{
using(AndroidJavaClass unityPlayer = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"))
{
using(AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject> ("currentActivity"))
{
adController = new AndroidJavaObject ("com.pad.android.iappad.AdController", activity, id);
}
}
}
void LoadAd()
{
adController.Call ("setAsynchTask", true);
adController.Call ("loadAd");
}
public void OnApplicationQuit()
{
adController.Call ("destroyAd");
}
}
But application is crashing upon load.
PeteS
2
Log in to Leadbolt and look up unity3d they have a sample scene with code available for unity3d. Its a unity package with all the required files to run. So far it worked for me but the sample ads take a few sec to pop up.