You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PlumberUltimateAds/Assets/IronSource/Scripts/IronSourceImpressionDataAnd...

48 lines
1.5 KiB
C#

2 months ago
#if UNITY_ANDROID
using System;
using UnityEngine;
public class IronSourceImpressionDataAndroid : AndroidJavaProxy, IUnityImpressionData
{
public event Action<IronSourceImpressionData> OnImpressionSuccess = delegate { };
public event Action<IronSourceImpressionData> OnImpressionDataReady = delegate { };
//implements UnityImpressionDataListener java interface
public IronSourceImpressionDataAndroid() : base(IronSourceConstants.impressionDataBridgeListenerClass)
{
try
{
using (var pluginClass = new AndroidJavaClass(IronSourceConstants.bridgeClass))
{
var bridgeInstance = pluginClass.CallStatic<AndroidJavaObject>(IronSourceConstants.GET_INSTANCE_KEY);
bridgeInstance.Call("setUnityImpressionDataListener", this);
}
}
catch (Exception e)
{
Debug.LogError("setUnityImpressionDataListener method doesn't exist, error: " + e.Message);
}
}
public void onImpressionSuccess(string data)
{
if (OnImpressionSuccess != null)
{
IronSourceImpressionData impressionData = new IronSourceImpressionData(data);
OnImpressionSuccess(impressionData);
}
}
public void onImpressionDataReady(string data)
{
if (OnImpressionDataReady != null)
{
IronSourceImpressionData impressionData = new IronSourceImpressionData(data);
OnImpressionDataReady(impressionData);
}
}
}
#endif