private VdopiaPlugin()
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                //Initialize VdopiaPlugin
                if (VDONativePlugin == null)
                {
                    using (var pluginClass = new AndroidJavaClass("com.vdopia.unity.plugin.VdopiaPlugin"))
                    {
                        VDONativePlugin = pluginClass.CallStatic <AndroidJavaObject>("GetInstance");
                    }
                }

                //Setting Context and Listener to Plugin
                if (VDONativePlugin != null)
                {
                    AndroidJavaClass  javaClass       = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                    AndroidJavaObject currentActivity = javaClass.GetStatic <AndroidJavaObject>("currentActivity");

                    VDONativePlugin.Call("SetActivity", currentActivity);
                    VDONativePlugin.Call("SetUnityAdListener", VdopiaListener.GetInstance());
                }
                else
                {
                    Debug.Log("Unable to Initialize VdopiaPlugin...");
                }
            }
        }
Exemple #2
0
        public static VdopiaListener GetInstance()
        {
            if (instance == null)
            {
                instance = new VdopiaListener();
            }

            return(instance);
        }