public static void StartSession() { if (_endThread) { return; } GAThreading.PerformTaskOnGAThread("startSession", () => { #if WINDOWS_UWP || WINDOWS_WSA if (GAState.UseManualSessionHandling) #endif { if (!GAState.Initialized) { return; } if (GAState.IsEnabled() && GAState.SessionIsStarted()) { GAState.EndSessionAndStopQueue(false); } GAState.ResumeSessionAndStartQueue(); } }); }
public static void Initialize(string gameKey, string gameSecret) { #if WINDOWS_UWP || WINDOWS_WSA || WINDOWS_PHONE CoreApplication.Suspending += OnSuspending; CoreApplication.Resuming += OnResuming; #endif GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("initialize", () => { if (IsSdkReady(true, false)) { GALogger.W("SDK already initialized. Can only be called once."); return; } if (!GAValidator.ValidateKeys(gameKey, gameSecret)) { GALogger.W("SDK failed initialize. Game key or secret key is invalid. Can only contain characters A-z 0-9, gameKey is 32 length, gameSecret is 40 length. Failed keys - gameKey: " + gameKey + ", secretKey: " + gameSecret); return; } GAState.SetKeys(gameKey, gameSecret); if (!GAStore.EnsureDatabase(false)) { GALogger.W("Could not ensure/validate local event database: " + GADevice.WritablePath); } GAState.InternalInitialize(); }); }
public static void SetEnabledManualSessionHandling(bool flag) { GAThreading.PerformTaskOnGAThread("setEnabledManualSessionHandling", () => { GAState.SetManualSessionHandling(flag); }); }
public static void OnResume() { GALogger.D("OnResume() called"); GAThreading.PerformTaskOnGAThread("onResume", () => { GAState.ResumeSessionAndStartQueue(); }); }
public static void SetFacebookId(string facebookId) { GAThreading.PerformTaskOnGAThread("setFacebookId", () => { if (GAValidator.ValidateFacebookId(facebookId)) { GAState.SetFacebookId(facebookId); } }); }
public static void SetGender(EGAGender gender) { GAThreading.PerformTaskOnGAThread("setGender", () => { if (GAValidator.ValidateGender(gender)) { GAState.SetGender(gender); } }); }
public static void SetBirthYear(int birthYear) { GAThreading.PerformTaskOnGAThread("setBirthYear", () => { if (GAValidator.ValidateBirthyear(birthYear)) { GAState.SetBirthYear(birthYear); } }); }
public static void ConfigureAvailableCustomDimensions03(params string[] customDimensions) { GAThreading.PerformTaskOnGAThread("configureAvailableCustomDimensions03", () => { if (IsSdkReady(true, false)) { GALogger.W("Available custom dimensions must be set before SDK is initialized"); return; } GAState.AvailableCustomDimensions03 = customDimensions; }); }
public static void SetGlobalCustomEventFields(IDictionary <string, object> customFields) { if (_endThread) { return; } GAThreading.PerformTaskOnGAThread("setGlobalCustomEventFields", () => { GAState.SetGlobalCustomEventFields(customFields); }); }
public static void ConfigureAvailableResourceItemTypes(params string[] resourceItemTypes) { GAThreading.PerformTaskOnGAThread("configureAvailableResourceItemTypes", () => { if (IsSdkReady(true, false)) { GALogger.W("Available resource item types must be set before SDK is initialized"); return; } GAState.AvailableResourceItemTypes = resourceItemTypes; }); }
public static void SetCustomDimension03(string dimension) { GAThreading.PerformTaskOnGAThread("setCustomDimension03", () => { if (!GAValidator.ValidateDimension03(dimension)) { GALogger.W("Could not set custom03 dimension value to '" + dimension + "'. Value not found in available custom03 dimension values"); return; } GAState.SetCustomDimension03(dimension); }); }
public static void AddDesignEvent(string eventId, double value) { GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addDesignEvent", () => { if (!IsSdkReady(true, true, "Could not add design event")) { return; } GAEvents.AddDesignEvent(eventId, value, true); }); }
public static void AddDesignEvent(string eventId, IDictionary <string, object> fields = null) { GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addDesignEvent", () => { if (!IsSdkReady(true, true, "Could not add design event")) { return; } GAEvents.AddDesignEvent(eventId, 0, false, fields); }); }
public static void AddErrorEvent(EGAErrorSeverity severity, string message) { GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addErrorEvent", () => { if (!IsSdkReady(true, true, "Could not add error event")) { return; } GAEvents.AddErrorEvent(severity, message); }); }
private static void OnResuming(object sender, object e) { GAThreading.PerformTaskOnGAThread("onResuming", () => { if (!GAState.UseManualSessionHandling) { OnResume(); } else { GALogger.I("OnResuming: Not calling GameAnalytics.OnResume() as using manual session handling"); } }); }
public static void OnStop() { GALogger.D("OnStop() called"); GAThreading.PerformTaskOnGAThread("onStop", () => { try { GAState.EndSessionAndStopQueue(); } catch (Exception) { } }); }
public static void AddBusinessEvent(string currency, int amount, string itemType, string itemId, string cartType) { GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addBusinessEvent", () => { if (!IsSdkReady(true, true, "Could not add business event")) { return; } // Send to events GAEvents.AddBusinessEvent(currency, amount, itemType, itemId, cartType); }); }
public static void AddResourceEvent(EGAResourceFlowType flowType, string currency, float amount, string itemType, string itemId) { GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addResourceEvent", () => { if (!IsSdkReady(true, true, "Could not add resource event")) { return; } GAEvents.AddResourceEvent(flowType, currency, amount, itemType, itemId); }); }
public static void ConfigureGameEngineVersion(string gameEngineVersion) { GAThreading.PerformTaskOnGAThread("configureGameEngineVersion", () => { if (IsSdkReady(true, false)) { return; } if (!GAValidator.ValidateEngineVersion(gameEngineVersion)) { GALogger.I("Validation fail - configure sdk version: Sdk version not supported. String: " + gameEngineVersion); return; } GADevice.GameEngineVersion = gameEngineVersion; }); }
public static void AddProgressionEvent(EGAProgressionStatus progressionStatus, string progression01, string progression02, string progression03, double score) { GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addProgressionEvent", () => { if (!IsSdkReady(true, true, "Could not add progression event")) { return; } // Send to events // TODO(nikolaj): check if this cast from int to double is OK GAEvents.AddProgressionEvent(progressionStatus, progression01, progression02, progression03, score, true); }); }
public static void SetEnabledVerboseLog(bool flag) { GAThreading.PerformTaskOnGAThread("setEnabledVerboseLog", () => { if (flag) { GALogger.VerboseLog = flag; GALogger.I("Verbose logging enabled"); } else { GALogger.I("Verbose logging disabled"); GALogger.VerboseLog = flag; } }); }
public static void ConfigureBuild(string build) { GAThreading.PerformTaskOnGAThread("configureBuild", () => { if (IsSdkReady(true, false)) { GALogger.W("Build version must be set before SDK is initialized."); return; } if (!GAValidator.ValidateBuild(build)) { GALogger.I("Validation fail - configure build: Cannot be null, empty or above 32 length. String: " + build); return; } GAState.Build = build; }); }
public static void AddDesignEvent(string eventId, double value, IDictionary <string, object> customFields = null, bool mergeFields = false) { if (_endThread) { return; } GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addDesignEvent", () => { if (!IsSdkReady(true, true, "Could not add design event")) { return; } GAEvents.AddDesignEvent(eventId, value, true, customFields, mergeFields); }); }
public static void ConfigureUserId(string uId) { GAThreading.PerformTaskOnGAThread("configureUserId", () => { if (IsSdkReady(true, false)) { GALogger.W("A custom user id must be set before SDK is initialized."); return; } if (!GAValidator.ValidateUserId(uId)) { GALogger.I("Validation fail - configure user_id: Cannot be null, empty or above 64 length. Will use default user_id method. Used string: " + uId); return; } GAState.UserId = uId; }); }
public static void AddErrorEvent(EGAErrorSeverity severity, string message /*, IDictionary<string, object> fields = null*/) { if (_endThread) { return; } GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addErrorEvent", () => { if (!IsSdkReady(true, true, "Could not add error event")) { return; } GAEvents.AddErrorEvent(severity, message, null); }); }
public static void AddResourceEvent(EGAResourceFlowType flowType, string currency, float amount, string itemType, string itemId, IDictionary <string, object> customFields = null, bool mergeFields = false) { if (_endThread) { return; } GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addResourceEvent", () => { if (!IsSdkReady(true, true, "Could not add resource event")) { return; } GAEvents.AddResourceEvent(flowType, currency, amount, itemType, itemId, customFields, mergeFields); }); }
public static void AddBusinessEvent(string currency, int amount, string itemType, string itemId, string cartType, IDictionary <string, object> customFields = null, bool mergeFields = false) { if (_endThread) { return; } GADevice.UpdateConnectionType(); GAThreading.PerformTaskOnGAThread("addBusinessEvent", () => { if (!IsSdkReady(true, true, "Could not add business event")) { return; } // Send to events GAEvents.AddBusinessEvent(currency, amount, itemType, itemId, cartType, customFields, mergeFields); }); }
public static void OnSuspend() { if (_endThread) { return; } GALogger.D("OnSuspend() called"); GAThreading.PerformTaskOnGAThread("onSuspend", () => { try { GAState.EndSessionAndStopQueue(false); } catch (Exception) { } }); }
public static void OnQuit() { if (_endThread) { return; } GALogger.D("OnQuit() called"); GAThreading.PerformTaskOnGAThread("onQuit", () => { try { _endThread = true; GAState.EndSessionAndStopQueue(true); } catch (Exception) { } }); }
public static void StartSession() { GAThreading.PerformTaskOnGAThread("startSession", () => { if (GAState.UseManualSessionHandling) { if (!GAState.Initialized) { return; } if (GAState.IsEnabled() && GAState.SessionIsStarted()) { GAState.EndSessionAndStopQueue(); } GAState.ResumeSessionAndStartQueue(); } }); }