Example #1
0
 // instance constructor
 private static void createInstance()
 {
     // create just one static instance for ever!
     if (staticInstance == null)
     {
         GameObject obj = new GameObject();
         staticInstance      = obj.AddComponent <AwesomeAds> ();
         staticInstance.name = "AwesomeAds";
         DontDestroyOnLoad(staticInstance);
     }
 }
Example #2
0
                    public static void init(bool loggingEnabled)
                    {
                        createInstance();

#if (UNITY_IPHONE && !UNITY_EDITOR)
                        var loggingEnabledL = loggingEnabled;
                        AwesomeAds.SuperAwesomeUnityAwesomeAdsInit(loggingEnabledL);
#elif (UNITY_ANDROID && !UNITY_EDITOR)
                        var loggingEnabledL = loggingEnabled;

                        var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                        var context    = unityClass.GetStatic <AndroidJavaObject> ("currentActivity");

                        context.Call("runOnUiThread", new AndroidJavaRunnable(() => {
                            var saplugin = new AndroidJavaClass("tv.superawesome.plugins.publisher.unity.SAUnityAwesomeAds");
                            saplugin.CallStatic("SuperAwesomeUnityAwesomeAdsInit", context, loggingEnabledL);
                        }));
#else
                        Debug.Log("Initialising SDK");
#endif
                    }
Example #3
0
                    public static void triggerAgeCheck(string age, Action <GetIsMinorModel> value)
                    {
                        createInstance();

                        callback = value;

#if (UNITY_IPHONE && !UNITY_EDITOR)
                        var ageL = age;
                        AwesomeAds.SuperAwesomeUnityAwesomeAdsTriggerAgeCheck(ageL);
#elif (UNITY_ANDROID && !UNITY_EDITOR)
                        var ageL = age;

                        var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                        var context    = unityClass.GetStatic <AndroidJavaObject> ("currentActivity");

                        context.Call("runOnUiThread", new AndroidJavaRunnable(() => {
                            var saplugin = new AndroidJavaClass("tv.superawesome.plugins.publisher.unity.SAUnityAwesomeAds");
                            saplugin.CallStatic("SuperAwesomeUnityAwesomeAdsTriggerAgeCheck", context, ageL);
                        }));
#else
                        Debug.Log("triggerAgeCheck for " + age);
#endif
                    }
Example #4
0
 // Use this for initialization
 void Awake()
 {
     AwesomeAds.init(true);
 }