// instance constructor private static void createInstance() { // create just one static instance for ever! if (staticInstance == null) { GameObject obj = new GameObject(); staticInstance = obj.AddComponent <SAAppWall> (); staticInstance.name = "SAAppWall"; DontDestroyOnLoad(staticInstance); // // set native version SAVersion.setVersionInNative(); #if (UNITY_IPHONE && !UNITY_EDITOR) SAAppWall.SuperAwesomeUnitySAAppWallCreate(); #elif (UNITY_ANDROID && !UNITY_EDITOR) 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.SAUnityAppWall"); saplugin.CallStatic("SuperAwesomeUnitySAAppWallCreate", context); })); #else Debug.Log("SAAppWall Create"); #endif } }
public static bool hasAdAvailable(int placementId) { // create an instrance of an SAAppWall (for callbacks) createInstance(); #if (UNITY_IPHONE && !UNITY_EDITOR) return(SAAppWall.SuperAwesomeUnitySAAppWallHasAdAvailable(placementId)); #elif (UNITY_ANDROID && !UNITY_EDITOR) var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); var context = unityClass.GetStatic <AndroidJavaObject> ("currentActivity"); var saplugin = new AndroidJavaClass("tv.superawesome.plugins.publisher.unity.SAUnityAppWall"); return(saplugin.CallStatic <bool>("SuperAwesomeUnitySAAppWallHasAdAvailable", context, placementId)); #else Debug.Log("SAAppWall HasAdAvailable"); return(false); #endif return(false); }
//////////////////////////////////////////////////////////////////// // GameWall specific methods //////////////////////////////////////////////////////////////////// public static void load(int placementId) { // create an instrance of an SAAppWall (for callbacks) createInstance(); #if (UNITY_IPHONE && !UNITY_EDITOR) SAAppWall.SuperAwesomeUnitySAAppWallLoad(placementId, (int)configuration, isTestingEnabled); #elif (UNITY_ANDROID && !UNITY_EDITOR) 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.SAUnityAppWall"); saplugin.CallStatic("SuperAwesomeUnitySAAppWallLoad", context, placementId, (int)configuration, isTestingEnabled); })); #else Debug.Log("SAAppWall Load"); #endif }