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.
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|