private void InternalStart(vx_sdk_config_t config) { if (_startCount > 0) { ++_startCount; return; } /// Initialize the VivoxNative module before returning the Client object #if (UNITY_ANDROID && !UNITY_EDITOR) || __ANDROID__ // Initialize the VivoxNative module AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject activity = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity"); AndroidJavaObject appContext = activity.Call <AndroidJavaObject>("getApplicationContext"); AndroidJavaClass pluginClass = new AndroidJavaClass("com.vivox.vivoxnative.VivoxNative"); pluginClass.CallStatic("init", appContext); #endif config.app_id = appId; int status = VivoxCoreInstance.Initialize(config); if (status != 0) { throw new VivoxApiException(status); } MessagePump.Instance.MainLoopRun += InstanceOnMainLoopRun; ++_startCount; //Start the Unity interop class that will setup the needed message pump #if UNITY_5_3_OR_NEWER VxUnityInterop.Instance.StartVivoxUnity(); #endif }
/// <param name="config">Optional: config to set on initialize.</param> public void Start(vx_sdk_config_t config = null) { if (_startCount > 0) { ++_startCount; return; } config = config == null ? new vx_sdk_config_t() : config; config.app_id = appId; int status = VivoxCoreInstance.Initialize(config); if (status != 0) { throw new VivoxApiException(status); } MessagePump.Instance.MainLoopRun += InstanceOnMainLoopRun; ++_startCount; }