static RegisterService() { Couchbase.Lite.Unity.UnityMainThreadScheduler.TaskFactory.StartNew(() => { UnityEngine.AndroidJavaClass c = new UnityEngine.AndroidJavaClass("com.unity3d.player.UnityPlayer"); var context = c.GetStatic <UnityEngine.AndroidJavaObject>("currentActivity"); if (context == null) { c.Dispose(); throw new Exception("Failed to get context"); } var arg = new UnityEngine.AndroidJavaObject("java.lang.String", "servicediscovery"); context.Call <UnityEngine.AndroidJavaObject>("getSystemService", arg); context.Dispose(); arg.Dispose(); c.Dispose(); _primedEvent.Set(); }); }
public static void StartNsd() { #if __UNITY_ANDROID__ UnityEngine.AndroidJavaClass c = new UnityEngine.AndroidJavaClass("com.unity3d.player.UnityPlayer"); var context = c.GetStatic <UnityEngine.AndroidJavaObject>("currentActivity"); var arg = new UnityEngine.AndroidJavaObject("java.lang.String", "servicediscovery"); context.Call <UnityEngine.AndroidJavaObject>("getSystemService", arg); context.Dispose(); arg.Dispose(); c.Dispose(); #endif }
static RegisterService() { UnityEngine.AndroidJavaClass c = new UnityEngine.AndroidJavaClass("com.unity3d.player.UnityPlayer"); var context = c.GetStatic<UnityEngine.AndroidJavaObject>("currentActivity"); if (context == null) { c.Dispose(); throw new Exception("Failed to get context"); } var arg = new UnityEngine.AndroidJavaObject("java.lang.String", "servicediscovery"); context.Call<UnityEngine.AndroidJavaObject>("getSystemService", arg); context.Dispose(); arg.Dispose(); c.Dispose(); }
static ServiceBrowser() { Couchbase.Lite.Unity.UnityMainThreadScheduler.TaskFactory.StartNew(() => { UnityEngine.AndroidJavaClass c = new UnityEngine.AndroidJavaClass("com.unity3d.player.UnityPlayer"); var context = c.GetStatic<UnityEngine.AndroidJavaObject>("currentActivity"); if (context == null) { c.Dispose(); throw new Exception("Failed to get context"); } var arg = new UnityEngine.AndroidJavaObject("java.lang.String", "servicediscovery"); context.Call<UnityEngine.AndroidJavaObject>("getSystemService", arg); context.Dispose(); arg.Dispose(); c.Dispose(); _primedEvent.Set(); }); }