public static void EndTimedEvent(string eventName, Dictionary <string, string> parameters = null) { FlurryAnalyticsAndroid.DebugLog("End timed event: " + eventName); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } if (parameters == null) { FlurryAnalyticsAndroid.Flurry.CallStatic("endTimedEvent", new object[] { eventName }); } else { using (AndroidJavaObject androidJavaObject = FlurryAnalyticsAndroid.ConvertDictionaryToJavaHashMap(parameters)) { FlurryAnalyticsAndroid.Flurry.CallStatic("endTimedEvent", new object[] { eventName, androidJavaObject }); } } }
/// <summary> /// Ends a timed event specified by eventName and optionally updates parameters with parameters. /// </summary> /// <param name="eventName"> /// Name of the event. For maximum effectiveness, we recommend using a naming scheme /// that can be easily understood by non-technical people in your business domain. /// </param> /// <param name="parameters">An immutable copy of map containing Name-Value pairs of parameters.</param> public void EndTimedEvent(string eventName, Dictionary <string, string> parameters = null) { #if UNITY_IOS FlurryAnalyticsIOS.EndTimedEvent(eventName, parameters); #elif UNITY_ANDROID FlurryAnalyticsAndroid.EndTimedEvent(eventName, parameters); #endif }
/// <summary> /// Explicitly set app version.. /// Should be called before StartSession. /// </summary> /// <param name="appVersion">App version.</param> public void SetAppVersion(string appVersion) { #if UNITY_IOS FlurryAnalyticsIOS.SetAppVersion(appVersion); #elif UNITY_ANDROID FlurryAnalyticsAndroid.SetVersionName(appVersion); #endif }
/// <summary> /// Sets the time the app may be in the background before starting a new session upon resume. /// Default value 10 seconds. /// /// Should be called before StartSession. /// </summary> public void SetSessionContinueSeconds(int seconds) { #if UNITY_IOS FlurryAnalyticsIOS.SetSessionContinueSeconds(seconds); #elif UNITY_ANDROID FlurryAnalyticsAndroid.SetContinueSessionMillis(seconds * 1000); #endif }
private static void DebugLog(string log) { if (!FlurryAnalyticsAndroid.EditorDebugLogEnabled()) { return; } UnityEngine.Debug.Log("[FlurryAnalyticsPlugin]: " + log); }
/// <summary> /// Use this method to capture the age of your user. /// </summary> public void SetAge(int age) { #if UNITY_IOS FlurryAnalyticsIOS.SetAge(age); #elif UNITY_ANDROID FlurryAnalyticsAndroid.SetAge(age); #endif }
/// <summary> /// On Destroy. /// </summary> protected override void OnDestroy() { base.OnDestroy(); #if UNITY_ANDROID FlurryAnalyticsAndroid.Dispose(); #endif }
/// <summary> /// Enable/Disable Flurry SDK debug logs. /// /// By default logs are disabled. /// Should be called before StartSession. /// </summary> public void SetDebugLogEnabled(bool enabled) { #if UNITY_IOS FlurryAnalyticsIOS.SetDebugLogEnabled(enabled); #elif UNITY_ANDROID FlurryAnalyticsAndroid.SetLogEnabled(enabled); #endif }
/// <summary> /// Start Flurry session. /// </summary> /// <param name="iOSApiKey">iOS API key.</param> /// <param name="androidApiKey">Android API key.</param> public void StartSession(string iOSApiKey, string androidApiKey, bool sendErrorsToFlurry) { #if UNITY_IOS FlurryAnalyticsIOS.StartSession(iOSApiKey, sendErrorsToFlurry); #elif UNITY_ANDROID FlurryAnalyticsAndroid.Init(androidApiKey, sendErrorsToFlurry); FlurryAnalyticsAndroid.OnStartSession(); #endif }
/// <summary> /// Set user's gender. /// </summary> public void SetGender(FlurryAnalytics.Gender gender) { #if UNITY_IOS FlurryAnalyticsIOS.SetGender(gender); #elif UNITY_ANDROID FlurryAnalyticsAndroid.SetGender(gender); #endif ReplicateUserGenderToUnityAnalytics(gender); }
/// <summary> /// Assign a unique id for a user in your app. /// </summary> public void SetUserId(string userId) { #if UNITY_IOS FlurryAnalyticsIOS.SetUserId(userId); #elif UNITY_ANDROID FlurryAnalyticsAndroid.SetUserId(userId); #endif ReplicateUserIdToUnityAnalytics(userId); }
/// <summary> /// Records a timed event specified by eventName. /// </summary> /// <param name="eventName"> /// Name of the event. For maximum effectiveness, we recommend using a naming scheme /// that can be easily understood by non-technical people in your business domain. /// </param> /// <param name="isTimed">If set to <c>true</c> event will be timed. /// Call EndTimedEvent to stop timed event.</param> public void LogEvent(string eventName, bool isTimed) { #if UNITY_IOS FlurryAnalyticsIOS.LogEvent(eventName, isTimed); #elif UNITY_ANDROID FlurryAnalyticsAndroid.LogEvent(eventName, isTimed); #endif ReplicateEventToUnityAnalytics(eventName); }
/// <summary> /// Records a custom parameterized timed event specified by eventName with parameters. /// A maximum of 10 parameter names may be associated with any event. /// </summary> /// <param name="eventName"> /// Name of the event. For maximum effectiveness, we recommend using a naming scheme /// that can be easily understood by non-technical people in your business domain. /// </param> /// <param name="parameters">An immutable copy of map containing Name-Value pairs of parameters.</param> /// <param name="isTimed">If set to <c>true</c> event will be timed. /// Call EndTimedEvent to stop timed event.</param> public void LogEventWithParameters(string eventName, Dictionary <string, string> parameters, bool isTimed) { #if UNITY_IOS FlurryAnalyticsIOS.LogEventWithParameters(eventName, parameters, isTimed); #elif UNITY_ANDROID FlurryAnalyticsAndroid.LogEventWithParameters(eventName, parameters, isTimed); #endif ReplicateEventToUnityAnalytics(eventName, parameters); }
public static void SetPulseEnabled(bool enabled) { if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setPulseEnabled", new object[] { enabled }); }
public static void SetCaptureUncaughtExceptions(bool enabled) { FlurryAnalyticsAndroid.DebugLog("Set capture unchaught exceptions: " + enabled); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setCaptureUncaughtExceptions", new object[] { enabled }); }
public static void SetContinueSessionMillis(long milliseconds) { FlurryAnalyticsAndroid.DebugLog("Set continue session seconds to: " + milliseconds / 1000L); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setContinueSessionMillis", new object[] { milliseconds }); }
public static void SetVersionName(string versionName) { FlurryAnalyticsAndroid.DebugLog("Application version changed to: " + versionName); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setVersionName", new object[] { versionName }); }
public static void SetAge(int age) { FlurryAnalyticsAndroid.DebugLog("Set user age: " + age); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setAge", new object[] { age }); }
public static void SetUserId(string userId) { FlurryAnalyticsAndroid.DebugLog("Set unique user id: " + userId); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setUserId", new object[] { userId }); }
public static void SetGender(FlurryAnalytics.Gender gender) { FlurryAnalyticsAndroid.DebugLog("Set user gender: " + gender); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setGender", new object[] { (gender != FlurryAnalytics.Gender.Male) ? 0 : 1 }); }
public static void SetReportLocation(bool report) { FlurryAnalyticsAndroid.DebugLog("Set report location: " + report); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setReportLocation", new object[] { report }); }
public static void OnEndSession() { FlurryAnalyticsAndroid.DebugLog("Session ended"); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } using (AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject @static = androidJavaClass.GetStatic <AndroidJavaObject>("currentActivity")) { FlurryAnalyticsAndroid.Flurry.CallStatic("onStartSession", new object[] { @static }); } } }
public static void LogEvent(string eventName, bool isTimed = false) { FlurryAnalyticsAndroid.DebugLog(string.Concat(new object[] { "Log event: ", eventName, " isTimed: ", isTimed })); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic <AndroidJavaObject>("logEvent", new object[] { eventName, isTimed }); }
public static void SetLocation(float latitude, float longitude) { FlurryAnalyticsAndroid.DebugLog(string.Concat(new object[] { "Set location: ", latitude, ", ", longitude })); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } FlurryAnalyticsAndroid.Flurry.CallStatic("setLocation", new object[] { latitude, longitude }); }
public static void LogPayment(string productName, string productId, int quantity, double price, string currency, string transactionId, Dictionary <string, string> parameters) { FlurryAnalyticsAndroid.DebugLog("Log payment: " + productName); if (parameters == null) { parameters = new Dictionary <string, string>(); } using (AndroidJavaObject androidJavaObject = FlurryAnalyticsAndroid.ConvertDictionaryToJavaHashMap(parameters)) { FlurryAnalyticsAndroid.Flurry.CallStatic <AndroidJavaObject>("logPayment", new object[] { productName, productId, quantity, price, currency, transactionId, androidJavaObject }); } }
private void OnGUI() { int num = 0; if (this.Button("Log Event", num++)) { SingletonCrossSceneAutoCreate <FlurryAnalytics> .Instance.LogEvent("KHD Sample Event"); } if (this.Button("Log Event Wit Parameters", num++)) { SingletonCrossSceneAutoCreate <FlurryAnalytics> .Instance.LogEventWithParameters("KHD Sample Event with parameters", new Dictionary <string, string> { { "Param1", "Value1" }, { "Param2", "Value2" }, { "Param3", "Value3" } }); } if (this.Button("Log Timed Event", num++)) { SingletonCrossSceneAutoCreate <FlurryAnalytics> .Instance.LogEvent("KHD Sample Timed Event New", true); } if (this.Button("End Timed Event", num++)) { SingletonCrossSceneAutoCreate <FlurryAnalytics> .Instance.EndTimedEvent("KHD Sample Timed Event New", null); } if (this.Button("Log Payment", num++)) { System.Random random = new System.Random(); FlurryAnalyticsAndroid.LogPayment("Test Payment", "com.khd.testpayment", 1, 0.99, "USD", SystemInfo.deviceUniqueIdentifier + random.Next(), null); } }
public static void Init(string apiKey, bool captureUncaughtExceptions = false) { FlurryAnalyticsAndroid.DebugLog(string.Concat(new object[] { "Init with key: ", apiKey, " capture exceptions: ", captureUncaughtExceptions })); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } if (apiKey != null) { apiKey = apiKey.ToUpper(); } if (string.IsNullOrEmpty(apiKey)) { FlurryAnalyticsAndroid.DebugLogError("Android API key is null or empty, please provide valid API key"); } using (AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject @static = androidJavaClass.GetStatic <AndroidJavaObject>("currentActivity")) { FlurryAnalyticsAndroid.Flurry.CallStatic("setCaptureUncaughtExceptions", new object[] { captureUncaughtExceptions }); FlurryAnalyticsAndroid.Flurry.CallStatic("init", new object[] { @static, apiKey.ToUpper() }); } } }
public static void LogEventWithParameters(string eventName, Dictionary <string, string> parameters, bool isTimed = false) { FlurryAnalyticsAndroid.DebugLog(string.Concat(new object[] { "Log event: ", eventName, " isTimed: ", isTimed, " with parameters" })); if (!FlurryAnalyticsAndroid.IsAndroidPlayer()) { return; } using (AndroidJavaObject androidJavaObject = FlurryAnalyticsAndroid.ConvertDictionaryToJavaHashMap(parameters)) { FlurryAnalyticsAndroid.Flurry.CallStatic <AndroidJavaObject>("logEvent", new object[] { eventName, androidJavaObject, isTimed }); } }
public void LogEventWithParameters(string eventName, Dictionary <string, string> parameters, bool isTimed) { FlurryAnalyticsAndroid.LogEventWithParameters(eventName, parameters, isTimed); this.ReplicateEventToUnityAnalytics(eventName, parameters); }
public void EndTimedEvent(string eventName, Dictionary <string, string> parameters = null) { FlurryAnalyticsAndroid.EndTimedEvent(eventName, parameters); }