Beispiel #1
0
        public static VdopiaAndroidListener GetInstance()
        {
            if (instance == null)
            {
                instance = new VdopiaAndroidListener();
            }

            return(instance);
        }
Beispiel #2
0
        private static AndroidJavaObject CreateAndroidPluginInstance()
        {
            using (var pluginClass = new AndroidJavaClass("com.vdopia.unity.plugin.VdopiaPlugin")) {
                VDONativePlugin = pluginClass.CallStatic <AndroidJavaObject>("GetInstance");
            }

            if (VDONativePlugin != null)
            {
                AndroidJavaClass  javaClass       = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                AndroidJavaObject currentActivity = javaClass.GetStatic <AndroidJavaObject>("currentActivity");

                VDONativePlugin.Call("SetActivity", currentActivity);
                VDONativePlugin.Call("SetUnityAdListener", VdopiaAndroidListener.GetInstance());
                VdopiaAndroidListener.GetInstance().VdopiaAdDelegateEventHandler += onVdopiaEventReceiver;
            }
            else
            {
                Debug.Log("Unable to Initialize VdopiaPlugin...");
            }
            return(VDONativePlugin);
        }