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.
48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
#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 |