/** * Disable local notifications */ static public void DisableLocalNotification() { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.DisableLocalNotifications(); #elif UNITY_ANDROID FGLAndroidInternals.DisableLocalNotifications(); #elif UNITY_IOS FGLiOSInternals.DisableLocalNotifications(); #endif }
/** * Update the value of a particular SDK key * * @param id ID of sdk to set key for * @param key key to set * @param value new value */ public static void SetSdkValue(string sdkId, string key, string value) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetSdkValue(sdkId, key, value); #elif UNITY_ANDROID FGLAndroidInternals.SetSdkValue(sdkId, key, value); #elif UNITY_IOS FGLiOSInternals.SetSdkValue(sdkId, key, value); #endif }
/** * Enable local notifications * * @param title notification title * @param message notification message * @param delay notification delay in seconds */ public static void EnableLocalNotification(string title, string message, int delay) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.EnableLocalNotifications(title, message, delay); #elif UNITY_ANDROID FGLAndroidInternals.EnableLocalNotifications(title, message, delay); #elif UNITY_IOS FGLiOSInternals.EnableLocalNotifications(title, message, delay); #endif }
/** * Set current screen * * @param name name of the currently displayed screen */ public static void SetCurrentScreen(string name) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetCurrentScreen(name); #elif UNITY_ANDROID FGLAndroidInternals.SetCurrentScreen(name); #elif UNITY_IOS FGLiOSInternals.SetCurrentScreen(name); #endif }
///// PUBLIC ///// /** * Log debug message to the console * * @param tag tag to use * @param message message to log */ public static void LogMessage(string tag, string message) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.LogMessage(tag, message); #elif UNITY_ANDROID FGLAndroidInternals.LogMessage(tag, message); #elif UNITY_IOS FGLiOSInternals.LogMessage(tag, message); #endif }
private static void _SetSdkConfiguration(string sdkId, string configurationKey, string configurationValue) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #elif UNITY_ANDROID FGLAndroidInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #elif UNITY_IOS FGLiOSInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #endif }
private static string _GetDisplayDescription(string sku, string defaultDescription) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(defaultDescription); #elif UNITY_ANDROID return(FGLAndroidInternals.GetDisplayDescription(sku, defaultDescription)); #elif UNITY_IOS return(FGLiOSInternals.GetDisplayDescription(sku, defaultDescription)); #endif }
// Interstitial Ad public void OnShowInterstitialAd() { // Check whether an interstitial ad is ready if (!Enhance.IsInterstitialReady()) { return; } // The ad is ready Enhance.ShowInterstitialAd(); }
// Offerwall public void OnShowOfferwall() { // Check whether an offerwall is available if (!Enhance.IsOfferwallReady()) { return; } // The offerwall is ready, show it Enhance.ShowOfferwall(); }
void Awake() { // Ask for permission to show local notifications // It can be done at any point in the application if (!_hasLocalNotificationPermission) { Enhance.RequestLocalNotificationPermission(OnPermissionGranted, OnPermissionRefused); } // Set currency callback (offerwalls) // It is important to do in the beginning of the application's logic }
// Special Offer public void OnShowSpecialOffer() { // Check whether a special offer is available if (!Enhance.IsSpecialOfferReady()) { return; } // The special offer is ready, display it Enhance.ShowSpecialOffer(); }
private static bool _IsItemOwned(string sku) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsItemOwned(sku)); #elif UNITY_ANDROID return(FGLAndroidInternals.IsItemOwned(sku)); #elif UNITY_IOS return(FGLiOSInternals.IsItemOwned(sku)); #else return(false); #endif }
private static int _GetOwnedItemCount(string sku) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.GetOwnedItemCount(sku)); #elif UNITY_ANDROID return(FGLAndroidInternals.GetOwnedItemCount(sku)); #elif UNITY_IOS return(FGLiOSInternals.GetOwnedItemCount(sku)); #else return(0); #endif }
// Local Notification public void OnEnableLocalNotification() { // Check if we have permission to schedule notification if (!_hasLocalNotificationPermission) { return; } // We have permission, enable a local notification // It will appear 5 seconds after the app is deactivated Enhance.EnableLocalNotification("Enhance", "Local Notification!", 5); }
///// PUBLIC ///// private static bool _IsSupported() { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsPurchasingSupported()); #elif UNITY_ANDROID return(FGLAndroidInternals.IsPurchasingSupported()); #elif UNITY_IOS return(FGLiOSInternals.IsPurchasingSupported()); #else return(false); #endif }
private static string _GetDisplayPrice(string sku, string defaultPrice) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.GetDisplayPrice(sku, defaultPrice)); #elif UNITY_ANDROID return(FGLAndroidInternals.GetDisplayPrice(sku, defaultPrice)); #elif UNITY_IOS return(FGLiOSInternals.GetDisplayPrice(sku, defaultPrice)); #else return(defaultPrice); #endif }
private static bool _IsProductStatusPending(string sku) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsProductStatusPending(sku)); #elif UNITY_ANDROID return(FGLAndroidInternals.IsProductStatusPending(sku)); #elif UNITY_IOS return(false); //iOS doesn't need pending transations #else return(false); #endif }
// Special Offer public void OnShowSpecialOffer() { // Check whether a special offer is available if (!Enhance.IsSpecialOfferReady()) { writeLog("Special offer is not ready"); return; } // The special offer is ready, display it Enhance.ShowSpecialOffer(); writeLog("Showing special offer"); }
// Offerwall public void OnShowOfferwall() { // Check whether an offerwall is available if (!Enhance.IsOfferwallReady()) { writeLog("Offerwall is not ready"); return; } // The offerwall is ready, show it Enhance.ShowOfferwall(); writeLog("Showing offerwall"); }
// Interstitial Ad public void OnShowInterstitialAd() { // Check whether an interstitial ad is ready if (!Enhance.IsInterstitialReady()) { writeLog("Interstitial ad is not ready"); return; } // The ad is ready Enhance.ShowInterstitialAd(); writeLog("Showing interstitial ad"); }
// Rewarded Ad public void OnShowRewardedAd() { // Check whether a rewarded ad is ready if (!Enhance.IsRewardedAdReady()) { writeLog("Rewarded ad is not ready"); return; } // The ad is ready, show it Enhance.ShowRewardedAd(OnRewardGranted, OnRewardDeclined, OnRewardUnavailable); writeLog("Showing rewarded ad"); }
private void EnhanceImage(MagickImage image) { if (Enhance == WhiteboardEnhancements.None) { return; } if (Enhance.HasFlag(WhiteboardEnhancements.Stretch)) { image.ContrastStretch((Percentage)0, (Percentage)0); } if (Enhance.HasFlag(WhiteboardEnhancements.Whitebalance)) { ApplyWhiteBalance(image); } }
void Awake() { // Ask for permission to show local notifications // It can be done at any point in the application if (!_hasLocalNotificationPermission) { Enhance.RequestLocalNotificationPermission(OnPermissionGranted, OnPermissionRefused); } // Set currency callback (offerwalls) // It is important to do in the beginning of the application's logic Enhance.SetReceivedCurrencyCallback(onCurrencyReceived); UpdateIAPLabel(); SetIapProductSku("Extra10Gems"); }
private static void _ManuallyRestorePurchases(Action onRestoreSuccessCallback, Action onRestoreFailedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnRestorePurchasesSuccessCallback = onRestoreSuccessCallback; FGLEnhance_Callbacks.OnRestorePurchasesFailedCallback = onRestoreFailedCallback; Enhance.InitializeEnhance(); #if UNITY_ANDROID FGLAndroidInternals.ManuallyRestorePurchases(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.ManuallyRestorePurchases(FGLEnhance_Callbacks.CallbackObjectName); #endif }
static public void ShowServiceOptInDialogs(string[] requestedSdks, Action onDialogComplete) { Enhance.InitializeEnhance(); if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnDialogCompleteCallback = onDialogComplete; #if UNITY_EDITOR Debug.Log("[Enhance] ShowServiceOptInDialogs - runned in Unity Editor, nothing to do"); #elif UNITY_ANDROID FGLAndroidInternals.ShowServiceOptInDialogs(requestedSdks, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.ShowServiceOptInDialogs(requestedSdks, FGLEnhance_Callbacks.CallbackObjectName); #endif }
/** * Request permission from the user to show local notifications * * @param onPermissionGrantedCallback executed when the permission is granted * @param onPermissionRefusedCallback executed when the permission is refused */ public static void RequestLocalNotificationPermission(Action onPermissionGrantedCallback, Action onPermissionRefusedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnLocalNotificationPermissionGrantedCallback = onPermissionGrantedCallback; FGLEnhance_Callbacks.OnLocalNotificationPermissionRefused = onPermissionRefusedCallback; Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #endif }
private static void _AttemptPurchase(string sku, Action onPurchaseSuccessCallback, Action onPurchaseFailedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnPurchaseSuccessCallback = onPurchaseSuccessCallback; FGLEnhance_Callbacks.OnPurchaseFailedCallback = onPurchaseFailedCallback; Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #endif }
/** * Show rewarded ad * * @param placement placement type for this ad * @param onRewardGrantedCallback callback executed when the ad reward is granted * @param onRewardDeclinedCallback callback executed when the ad reward is declined * @param onRewardUnavailableCallback callback executed when the ad reward is unavailable */ public static void ShowRewardedAd(string placement, Action <FGLEnhance.RewardType, int> onRewardGrantedCallback, Action onRewardDeclinedCallback, Action onRewardUnavailableCallback) { Action <Enhance.RewardType, int> onGrantedAction = delegate(Enhance.RewardType rType, int rValue) { FGLEnhance.RewardType fglRewardType = FGLEnhance.RewardType.REWARDTYPE_ITEM; if (rType == Enhance.RewardType.COINS) { fglRewardType = FGLEnhance.RewardType.REWARDTYPE_COINS; } onRewardGrantedCallback(fglRewardType, rValue); }; Action onDeclinedAction = delegate() { onRewardDeclinedCallback(); }; Action onUnavailableAction = delegate() { onRewardUnavailableCallback(); }; Enhance.ShowRewardedAd(placement, onGrantedAction, onDeclinedAction, onUnavailableAction); }
static public void RequiresDataConsentOptIn(Action onRequired, Action onNotRequired) { Enhance.InitializeEnhance(); if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnOptInRequiredCallback = onRequired; FGLEnhance_Callbacks.OnOptInNotRequiredCallback = onNotRequired; #if UNITY_EDITOR if (onNotRequired != null) { onNotRequired(); } #elif UNITY_ANDROID FGLAndroidInternals.RequiresDataConsentOptIn(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.RequiresDataConsentOptIn(FGLEnhance_Callbacks.CallbackObjectName); #endif }
/* * Example code to handle App Tracking Transparency on iOS * * Provide both callbacks, even if you do not care about the results. You can resume * your app using the callback functions. */ public void OnRequestAppTrackingTransparencyAuthorization() { Enhance.RequestAppTrackingTransparencyAuthorization(OnAttApproved, OnAttRejected); }