Exemplo n.º 1
0
 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
             });
         }
     }
 }
Exemplo n.º 2
0
        /// <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
        }
Exemplo n.º 3
0
        /// <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
        }
Exemplo n.º 4
0
        /// <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
        }
Exemplo n.º 5
0
 private static void DebugLog(string log)
 {
     if (!FlurryAnalyticsAndroid.EditorDebugLogEnabled())
     {
         return;
     }
     UnityEngine.Debug.Log("[FlurryAnalyticsPlugin]: " + log);
 }
Exemplo n.º 6
0
        /// <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
        }
Exemplo n.º 7
0
        /// <summary>
        /// On Destroy.
        /// </summary>
        protected override void OnDestroy()
        {
            base.OnDestroy();

#if UNITY_ANDROID
            FlurryAnalyticsAndroid.Dispose();
#endif
        }
Exemplo n.º 8
0
        /// <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
        }
Exemplo n.º 9
0
        /// <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
        }
Exemplo n.º 10
0
        /// <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);
        }
Exemplo n.º 11
0
        /// <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);
        }
Exemplo n.º 12
0
        /// <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);
        }
Exemplo n.º 13
0
        /// <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);
        }
Exemplo n.º 14
0
 public static void SetPulseEnabled(bool enabled)
 {
     if (!FlurryAnalyticsAndroid.IsAndroidPlayer())
     {
         return;
     }
     FlurryAnalyticsAndroid.Flurry.CallStatic("setPulseEnabled", new object[]
     {
         enabled
     });
 }
Exemplo n.º 15
0
 public static void SetCaptureUncaughtExceptions(bool enabled)
 {
     FlurryAnalyticsAndroid.DebugLog("Set capture unchaught exceptions: " + enabled);
     if (!FlurryAnalyticsAndroid.IsAndroidPlayer())
     {
         return;
     }
     FlurryAnalyticsAndroid.Flurry.CallStatic("setCaptureUncaughtExceptions", new object[]
     {
         enabled
     });
 }
Exemplo n.º 16
0
 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
     });
 }
Exemplo n.º 17
0
 public static void SetVersionName(string versionName)
 {
     FlurryAnalyticsAndroid.DebugLog("Application version changed to: " + versionName);
     if (!FlurryAnalyticsAndroid.IsAndroidPlayer())
     {
         return;
     }
     FlurryAnalyticsAndroid.Flurry.CallStatic("setVersionName", new object[]
     {
         versionName
     });
 }
Exemplo n.º 18
0
 public static void SetAge(int age)
 {
     FlurryAnalyticsAndroid.DebugLog("Set user age: " + age);
     if (!FlurryAnalyticsAndroid.IsAndroidPlayer())
     {
         return;
     }
     FlurryAnalyticsAndroid.Flurry.CallStatic("setAge", new object[]
     {
         age
     });
 }
Exemplo n.º 19
0
 public static void SetUserId(string userId)
 {
     FlurryAnalyticsAndroid.DebugLog("Set unique user id: " + userId);
     if (!FlurryAnalyticsAndroid.IsAndroidPlayer())
     {
         return;
     }
     FlurryAnalyticsAndroid.Flurry.CallStatic("setUserId", new object[]
     {
         userId
     });
 }
Exemplo n.º 20
0
 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
     });
 }
Exemplo n.º 21
0
 public static void SetReportLocation(bool report)
 {
     FlurryAnalyticsAndroid.DebugLog("Set report location: " + report);
     if (!FlurryAnalyticsAndroid.IsAndroidPlayer())
     {
         return;
     }
     FlurryAnalyticsAndroid.Flurry.CallStatic("setReportLocation", new object[]
     {
         report
     });
 }
Exemplo n.º 22
0
 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
             });
         }
     }
 }
Exemplo n.º 23
0
 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
     });
 }
Exemplo n.º 24
0
 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
     });
 }
Exemplo n.º 25
0
 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
         });
     }
 }
Exemplo n.º 26
0
        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);
            }
        }
Exemplo n.º 27
0
 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()
             });
         }
     }
 }
Exemplo n.º 28
0
 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
         });
     }
 }
Exemplo n.º 29
0
 public void LogEventWithParameters(string eventName, Dictionary <string, string> parameters, bool isTimed)
 {
     FlurryAnalyticsAndroid.LogEventWithParameters(eventName, parameters, isTimed);
     this.ReplicateEventToUnityAnalytics(eventName, parameters);
 }
Exemplo n.º 30
0
 public void EndTimedEvent(string eventName, Dictionary <string, string> parameters = null)
 {
     FlurryAnalyticsAndroid.EndTimedEvent(eventName, parameters);
 }