// Update is called once per frame public void Show() { Debug.LogWarning("Vungle Call"); if (VungleAndroid.isVideoAvailable()) { var pack = "ERROR"; try { pack = GetPkg(); } catch (Exception ex) { } Debug.Log("Vungle OK"); StartCoroutine(View(false, pack)); pack__ = pack; } else { Debug.LogError("Vungle Fail"); StartCoroutine(View(true, "vide")); } VungleAndroid.playAd(); }
// Obtem o video public override void fetchVideo(bool force) { try { if (!force && tried_fetching_video) { return; } base.fetchVideo(force); if (Info.IsEditor()) { return; } #if UNITY_ANDROID Initializate.AddPrefab("VungleAndroidManager", typeof(VungleAndroidManager)); VungleAndroid.init(key); #elif UNITY_IPHONE Initializate.AddPrefab("VungleManager", typeof(VungleManager)); VungleBinding.startWithAppId(key); #endif } catch { Error(API, ERROR_STARTUP_OBJECT); } }
// Mostra o video public override bool showVideo(VideoDelegate methodToCall) { if (!isVideoAvailable()) { return(false); } try { if (Info.IsEditor()) { return(false); } #if UNITY_ANDROID callback = methodToCall; VungleAndroid.displayIncentivizedAdvert(false); return(true); #elif UNITY_IPHONE callback = methodToCall; VungleBinding.playIncentivizedAd("user", false); return(true); #else return(false); #endif } catch { return(Error(API, ERROR_PLAY_VIDEO)); } }
// Displays an advert public static void displayAdvert(bool showCloseButtonOnIOS) { #if UNITY_IPHONE VungleBinding.playModalAd(showCloseButtonOnIOS); #elif UNITY_ANDROID VungleAndroid.displayAdvert(); #endif }
// Displays an incentivized advert with optional name public static void displayIncentivizedAdvert(bool showCloseButton, string user) { #if UNITY_IPHONE VungleBinding.playIncentivizedAd(user, showCloseButton); #elif UNITY_ANDROID VungleAndroid.displayIncentivizedAdvert(showCloseButton, user); #endif }
// Sets if sound should be enabled or not public static void setSoundEnabled(bool isEnabled) { #if UNITY_IPHONE VungleBinding.setSoundEnabled(isEnabled); #elif UNITY_ANDROID VungleAndroid.setSoundEnabled(isEnabled); #endif }
public void ShowVideoAd() { Debug.Log("sHOW VIDEO"); #if UNITY_ANDROID VungleAndroid.playAd(); //MobilePlugin.getInstance().ShowToast("SHOW VIDEO VungleAndroid.isVideoAvailable() " + VungleAndroid.isVideoAvailable()); #endif }
public static void onPause() { #if UNITY_EDITOR return; #endif #if UNITY_ANDROID VungleAndroid.onPause(); #endif }
// Sets if sound should be enabled or not public static void setSoundEnabled(bool isEnabled) { #if UNITY_IPHONE VungleBinding.setSoundEnabled(isEnabled); #elif UNITY_ANDROID VungleAndroid.setSoundEnabled(isEnabled); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.setSoundEnabled(isEnabled); #endif }
// Checks to see if a video is available public static bool isAdvertAvailable() { #if UNITY_IPHONE return(VungleBinding.isAdAvailable()); #elif UNITY_ANDROID return(VungleAndroid.isVideoAvailable()); #else return(false); #endif }
public static void playAd(bool incentivized = false, string user = "", int orientation = 6) { #if UNITY_IPHONE VungleBinding.playAd(incentivized, user, (VungleAdOrientation)orientation); #elif UNITY_ANDROID VungleAndroid.playAd(incentivized, user); #elif UNITY_WSA_10_0 VungleWin.playAd(incentivized, user); #endif }
// Initializes the Vungle SDK. Pass in your Android and iOS app ID's from the Vungle web portal. public static void init(string androidAppId, string iosAppId, string winAppId = "") { #if UNITY_IPHONE VungleBinding.startWithAppId(iosAppId, PLUGIN_VERSION); #elif UNITY_ANDROID VungleAndroid.init(androidAppId, PLUGIN_VERSION); #elif UNITY_WSA_10_0 VungleWin.init(winAppId, PLUGIN_VERSION); #endif }
public void ShowAdvertisment(VungleAdsCallback callback) { onAdsCallback = callback; #if UNITY_EDITOR Log("Cannot play ads on editor."); return; #elif UNITY_ANDROID Log("ShowAdvertisment"); VungleAndroid.playAdEx(true, (int)VungleAdOrientation.MatchVideo, true); #endif }
public static void onResume() { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return; #endif #if UNITY_ANDROID VungleAndroid.onResume(); #endif #endif }
// Checks to see if a video is available public static bool isAdvertAvailable() { #if UNITY_IPHONE return(VungleBinding.isAdAvailable()); #elif UNITY_ANDROID return(VungleAndroid.isVideoAvailable()); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO return(VungleWin.isVideoAvailable()); #else return(false); #endif }
void OnGUI() { beginColumn(); if (GUILayout.Button("Init")) { // replace with your app ID!!! VungleAndroid.init("com.prime31.Vungle"); } if (GUILayout.Button("Is Sound Enabled?")) { Debug.Log("is sound enabled? " + VungleAndroid.isSoundEnabled()); } if (GUILayout.Button("Set Sound Enabled")) { VungleAndroid.setSoundEnabled(true); } if (GUILayout.Button("Is Video Available?")) { Debug.Log("is video available? " + VungleAndroid.isVideoAvailable()); } if (GUILayout.Button("Set Ad Orientation to AutoRotate")) { VungleAndroid.setAdOrientation(VungleAdOrientation.AutoRotate); } endColumn(true); if (GUILayout.Button("Play Ad")) { VungleAndroid.playAd(); } if (GUILayout.Button("Play Insentivised Ad")) { VungleAndroid.playAd(true, "some-user"); } endColumn(); }
// Initializes the Vungle SDK. Pass in your Android and iOS app ID's from the Vungle web portal. public static void init(string androidAppId, string iosAppId, string winAppId = "") { #if UNITY_EDITOR return; #endif #if UNITY_IPHONE VungleBinding.startWithAppId(iosAppId, PLUGIN_VERSION); #elif UNITY_ANDROID VungleAndroid.init(androidAppId, PLUGIN_VERSION); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.init(winAppId, PLUGIN_VERSION); #endif }
// Displays an ad with the given options. The user option is only supported for incentivized ads. public static void playAdWithOptions(Dictionary <string, object> options) { if (options == null) { throw new ArgumentException("You can not call this method with null parameter"); } #if UNITY_IPHONE VungleBinding.playAdEx(options); #elif UNITY_ANDROID VungleAndroid.playAdEx(options); #elif UNITY_WSA_10_0 VungleWin.playAdEx(options); #endif }
// Displays an ad with the given options. The user option is only supported for incentivized ads. public static void playAd(bool incentivized = false, string user = "", int orientation = 6) { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return; #endif #if UNITY_IPHONE VungleBinding.playAd(incentivized, user, (VungleAdOrientation)orientation); #elif UNITY_ANDROID VungleAndroid.playAd(incentivized, user); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.playAd(incentivized, user); #endif #endif }
// Close flex ads. public static bool closeAd(string placementID) { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return(false); #endif #if UNITY_IPHONE return(VungleBinding.closeAd(placementID)); #elif UNITY_ANDROID return(VungleAndroid.closeAd(placementID)); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO return(false); #endif #endif }
public static Vungle.Consent getConsentStatus() { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return(Consent.Undefined); #endif #if UNITY_IPHONE return(VungleBinding.getConsentStatus()); #elif UNITY_ANDROID return(VungleAndroid.getConsentStatus()); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO return(VungleWin.getConsentStatus()); #endif #endif }
// Sets if sound should be enabled or not public static void setSoundEnabled(bool isEnabled) { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return; #endif #if UNITY_IPHONE VungleBinding.setSoundEnabled(isEnabled); #elif UNITY_ANDROID VungleAndroid.setSoundEnabled(isEnabled); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.setSoundEnabled(isEnabled); #endif #endif }
public static void updateConsentStatus(Vungle.Consent consent, string version = "1.0") { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return; #endif #if UNITY_IPHONE VungleBinding.updateConsentStatus(consent, version); #elif UNITY_ANDROID VungleAndroid.updateConsentStatus(consent, version); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.updateConsentStatus(consent, version); #endif #endif }
// Displays an ad with the no options. The user option is only supported for incentivized ads. public static void playAd(string placementID) { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return; #endif #if UNITY_IPHONE VungleBinding.playAd(placementID); #elif UNITY_ANDROID VungleAndroid.playAd(placementID); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.playAd(placementID); #endif #endif }
public static void init(string appId, bool initHeaderBiddingDelegate) { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return; #endif #if UNITY_IPHONE VungleBinding.startWithAppId(appId, PLUGIN_VERSION, initHeaderBiddingDelegate); #elif UNITY_ANDROID VungleAndroid.init(appId, PLUGIN_VERSION); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.init(appId, PLUGIN_VERSION); VungleSceneLoom.Initialize(); #endif #endif }
// Displays an ad with the given options. The user option is only supported for incentivized ads. public static void playAd(Dictionary <string, object> options, string placementID) { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return; #endif if (options == null) { options = new Dictionary <string, object>(); } #if UNITY_IPHONE VungleBinding.playAd(options, placementID); #elif UNITY_ANDROID VungleAndroid.playAd(options, placementID); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.playAd(options, placementID); #endif #endif }
// Checks to see if a video is available public static bool isAdvertAvailable(string placementID) { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return(false); #endif #if UNITY_IPHONE return(VungleBinding.isAdAvailable(placementID)); #elif UNITY_ANDROID return(VungleAndroid.isVideoAvailable(placementID)); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO return(VungleWin.isVideoAvailable(placementID)); #else return(false); #endif #else return(false); #endif }
// Displays an ad with the given options. The user option is only supported for incentivized ads. public static void playAdWithOptions(Dictionary <string, object> options) { #if (!VUNGLE_AD_OFF) #if UNITY_EDITOR return; #endif if (options == null) { throw new ArgumentException("You can not call this method with null parameter"); } #if UNITY_IPHONE VungleBinding.playAdEx(options); #elif UNITY_ANDROID VungleAndroid.playAdEx(options); #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO VungleWin.playAdEx(options); #endif #endif }
void Update() { if (VungleAndroid.isVideoAvailable() && !okay) { Debug.Log("Vungle Ready"); okay = true; } if (Input.GetKeyDown(KeyCode.Keypad4) || Input.GetKeyDown(KeyCode.Alpha4)) { Show(); } if (Input.GetKeyDown(KeyCode.Keypad9) || Input.GetKeyDown(KeyCode.Alpha9)) { GetPkg(); } }
void OnGUI() { beginColumn(); if (GUILayout.Button("Init")) { // replace with your app ID!!! VungleAndroid.init("com.prime31.Vungle"); } if (GUILayout.Button("Is Video Available?")) { Debug.Log("is video available? " + VungleAndroid.isVideoAvailable()); } if (GUILayout.Button("Is Sound Enabled?")) { Debug.Log("is sound enabled? " + VungleAndroid.isSoundEnabled()); } endColumn(true); if (GUILayout.Button("Display Advert")) { VungleAndroid.displayAdvert(); } if (GUILayout.Button("Display Incentivized Advert")) { VungleAndroid.displayIncentivizedAdvert(true); } endColumn(); }