public static void playAd( Dictionary<string,object> options, string placement) { if (sdk != null && sdk.IsAdPlayable(placement)) { cfg = new AdConfig (); if (options.ContainsKey("userTag") && options["userTag"] is string) cfg.SetUserId ((string) options["userTag"]); cfg.SetSoundEnabled (_isSoundEnabled); if (options.ContainsKey("orientation")) { if (options ["orientation"] is bool) { cfg.SetOrientation (((bool)options ["orientation"]) ? VungleSDKProxy.DisplayOrientations.Landscape : VungleSDKProxy.DisplayOrientations.AutoRotate); } if (options ["orientation"] is VungleAdOrientation) { cfg.SetOrientation(((VungleAdOrientation)options ["orientation"] == VungleAdOrientation.AutoRotate) ? VungleSDKProxy.DisplayOrientations.AutoRotate : VungleSDKProxy.DisplayOrientations.Landscape); } } else cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate) ? VungleSDKProxy.DisplayOrientations.AutoRotate : VungleSDKProxy.DisplayOrientations.Landscape); if (options.ContainsKey("alertText") && options["alertText"] is string) cfg.SetIncentivizedDialogBody ((string) options["alertText"]); if (options.ContainsKey("alertTitle") && options["alertTitle"] is string) cfg.SetIncentivizedDialogTitle ((string) options["alertTitle"]); if (options.ContainsKey("closeText") && options["closeText"] is string) cfg.SetIncentivizedDialogCloseButton ((string) options["closeText"]); if (options.ContainsKey("continueText") && options["continueText"] is string) cfg.SetIncentivizedDialogContinueButton ((string) options["continueText"]); if (options.ContainsKey("backImmediately") && options["backImmediately"] is string) cfg.SetBackButtonImmediatelyEnabled ((bool) options["backImmediately"]); if (options.ContainsKey("flexCloseSec") && options["flexCloseSec"] is string) { int seconds = 0; Int32.TryParse((string)options["flexCloseSec"], out seconds); sdk.SetFlexViewCloseTimeInSec(placement, seconds); } sdk.PlayAd(cfg, placement); } }
private void SetAdConfig(AdConfig config, Dictionary <string, object> options) { cfg.SetSoundEnabled(this.isSoundEnabled); SetValue <string>(options, OptionConstants.UserTag, cfg.SetUserId); if (options.ContainsKey(OptionConstants.Orientation)) { if (!SetValue(options, OptionConstants.Orientation, cfg.SetOrientation, (bool b) => { return(b ? DisplayOrientations.Landscape : DisplayOrientations.AutoRotate); })) { SetValue(options, OptionConstants.Orientation, cfg.SetOrientation, (VungleAdOrientation vao) => { return((vao == VungleAdOrientation.AutoRotate) ? DisplayOrientations.AutoRotate : DisplayOrientations.Landscape); }); } } else { cfg.SetOrientation((orientation == VungleAdOrientation.AutoRotate) ? DisplayOrientations.AutoRotate : DisplayOrientations.Landscape); } SetValue <string>(options, OptionConstants.AlertText, cfg.SetIncentivizedDialogBody); SetValue <string>(options, OptionConstants.AlertTitle, cfg.SetIncentivizedDialogTitle); SetValue <string>(options, OptionConstants.CloseText, cfg.SetIncentivizedDialogCloseButton); SetValue <string>(options, OptionConstants.ContinueText, cfg.SetIncentivizedDialogContinueButton); SetValue <bool>(options, OptionConstants.BackImmediately, cfg.SetBackButtonImmediatelyEnabled); }
// Plays an ad with the given options. The user option is only supported for incentivized ads. public static void playAd(string placement) { if (sdk != null && sdk.IsAdPlayable(placement)) { cfg = new AdConfig (); cfg.SetUserId (""); cfg.SetSoundEnabled (_isSoundEnabled); cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); sdk.PlayAd(cfg, placement); } }
// Plays an ad with the given options. The user option is only supported for incentivized ads. public static void playAd( bool incentivized = false, string user = "" ) { if (sdk != null && sdk.AdPlayable) { cfg = new AdConfig (); cfg.SetIncentivized (incentivized); cfg.SetUserId (user); cfg.SetSoundEnabled (_isSoundEnabled); cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); sdk.PlayAd (cfg); } }
// Plays an ad with the given options. The user option is only supported for incentivized ads. public static void playAd(bool incentivized = false, string user = "") { if (sdk != null && sdk.AdPlayable) { cfg = new AdConfig(); cfg.SetIncentivized(incentivized); cfg.SetUserId(user); cfg.SetSoundEnabled(_isSoundEnabled); cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); sdk.PlayAd(cfg); } }
public void PlayAd(string placementId) { InvokeSafelyOnUIThreadAsync(delegate { if (sdk != null && sdk.IsAdPlayable(placementId)) { cfg = new AdConfig(); cfg.SetUserId(string.Empty); cfg.SetSoundEnabled(this.isSoundEnabled); cfg.SetOrientation((orientation == VungleAdOrientation.AutoRotate) ? DisplayOrientations.AutoRotate : DisplayOrientations.Landscape); sdk.PlayAd(cfg, placementId); } }); }
public static void playAdEx(Dictionary <string, object> options) { if (sdk != null && sdk.AdPlayable) { cfg = new AdConfig(); if (options.ContainsKey("incentivized") && options["incentivized"] is bool) { cfg.SetIncentivized((bool)options["incentivized"]); } if (options.ContainsKey("userTag") && options["userTag"] is string) { cfg.SetUserId((string)options["userTag"]); } cfg.SetSoundEnabled(_isSoundEnabled); if (options.ContainsKey("orientation") && options["orientation"] is bool) { cfg.SetOrientation(((bool)options["orientation"])?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); } else { cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); } if (options.ContainsKey("placement") && options["placement"] is string) { cfg.SetPlacement((string)options["placement"]); } if (options.ContainsKey("alertText") && options["alertText"] is string) { cfg.SetIncentivizedDialogBody((string)options["alertText"]); } if (options.ContainsKey("alertTitle") && options["alertTitle"] is string) { cfg.SetIncentivizedDialogTitle((string)options["alertTitle"]); } if (options.ContainsKey("closeText") && options["closeText"] is string) { cfg.SetIncentivizedDialogCloseButton((string)options["closeText"]); } if (options.ContainsKey("continueText") && options["continueText"] is string) { cfg.SetIncentivizedDialogContinueButton((string)options["continueText"]); } if (options.ContainsKey("backImmediately") && options["backImmediately"] is string) { cfg.SetBackButtonImmediatelyEnabled((bool)options["backImmediately"]); } string[] extra = cfg.GetExtra(); if (options.ContainsKey("key1") && options["key1"] is string) { extra[0] = (string)options["key1"]; } if (options.ContainsKey("key2") && options["key2"] is string) { extra[1] = (string)options["key2"]; } if (options.ContainsKey("key3") && options["key3"] is string) { extra[2] = (string)options["key3"]; } if (options.ContainsKey("key4") && options["key4"] is string) { extra[3] = (string)options["key4"]; } if (options.ContainsKey("key5") && options["key5"] is string) { extra[4] = (string)options["key5"]; } if (options.ContainsKey("key6") && options["key6"] is string) { extra[5] = (string)options["key6"]; } if (options.ContainsKey("key7") && options["key7"] is string) { extra[6] = (string)options["key7"]; } if (options.ContainsKey("key8") && options["key8"] is string) { extra[7] = (string)options["key8"]; } sdk.PlayAd(cfg); } }
public static void playAdEx( Dictionary<string,object> options) { if (sdk != null && sdk.AdPlayable) { cfg = new AdConfig (); if (options.ContainsKey("incentivized") && options["incentivized"] is bool) cfg.SetIncentivized ((bool) options["incentivized"]); if (options.ContainsKey("userTag") && options["userTag"] is string) cfg.SetUserId ((string) options["userTag"]); cfg.SetSoundEnabled (_isSoundEnabled); if (options.ContainsKey("orientation") && options["orientation"] is bool) cfg.SetOrientation(((bool)options["orientation"])?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); else cfg.SetOrientation((_orientation == VungleAdOrientation.AutoRotate)?VungleSDKProxy.DisplayOrientations.AutoRotate:VungleSDKProxy.DisplayOrientations.Landscape); if (options.ContainsKey("placement") && options["placement"] is string) cfg.SetPlacement ((string) options["placement"]); if (options.ContainsKey("alertText") && options["alertText"] is string) cfg.SetIncentivizedDialogBody ((string) options["alertText"]); if (options.ContainsKey("alertTitle") && options["alertTitle"] is string) cfg.SetIncentivizedDialogTitle ((string) options["alertTitle"]); if (options.ContainsKey("closeText") && options["closeText"] is string) cfg.SetIncentivizedDialogCloseButton ((string) options["closeText"]); if (options.ContainsKey("continueText") && options["continueText"] is string) cfg.SetIncentivizedDialogContinueButton ((string) options["continueText"]); if (options.ContainsKey("backImmediately") && options["backImmediately"] is string) cfg.SetBackButtonImmediatelyEnabled ((bool) options["backImmediately"]); string[] extra = cfg.GetExtra(); if (options.ContainsKey("key1") && options["key1"] is string) extra[0] = (string) options["key1"]; if (options.ContainsKey("key2") && options["key2"] is string) extra[1] = (string) options["key2"]; if (options.ContainsKey("key3") && options["key3"] is string) extra[2] = (string) options["key3"]; if (options.ContainsKey("key4") && options["key4"] is string) extra[3] = (string) options["key4"]; if (options.ContainsKey("key5") && options["key5"] is string) extra[4] = (string) options["key5"]; if (options.ContainsKey("key6") && options["key6"] is string) extra[5] = (string) options["key6"]; if (options.ContainsKey("key7") && options["key7"] is string) extra[6] = (string) options["key7"]; if (options.ContainsKey("key8") && options["key8"] is string) extra[7] = (string) options["key8"]; sdk.PlayAd (cfg); } }