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/IronSourceSegmentAndroid.cs

35 lines
982 B
C#

3 months ago
using System;
using UnityEngine;
public class IronSourceSegmentAndroid : AndroidJavaProxy, IUnitySegment
{
public event Action<string> OnSegmentRecieved = delegate { };
//implements UnitySegmentListener java interface
public IronSourceSegmentAndroid():base(IronSourceConstants.segmentBridgeListenerClass)
{
try
{
using (var pluginClass = new AndroidJavaClass(IronSourceConstants.bridgeClass))
{
var bridgeInstance = pluginClass.CallStatic<AndroidJavaObject>("getInstance");
bridgeInstance.Call("setUnitySegmentListener", this);
}
}
catch(Exception e)
{
Debug.LogError("setUnitySegmentListener method doesn't exist, error: " + e.Message);
}
}
public void onSegmentRecieved(string segmentName){
if(OnSegmentRecieved != null)
{
OnSegmentRecieved(segmentName);
}
}
}