Esempio n. 1
0
 public static void SetNewSession(HitBuilders.HitBuilder builder)
 {
     if (HitBuilderSetNewSessionId == IntPtr.Zero)
     {
         HitBuilderSetNewSessionId = Android.Runtime.JNIEnv.GetMethodID(HitBuilderClassRef, "setNewSession", "()Lcom/google/android/gms/analytics/HitBuilders$HitBuilder;");
     }
     Android.Runtime.JNIEnv.CallObjectMethod(builder.Handle, HitBuilderSetNewSessionId);
 }
Esempio n. 2
0
        private void SendHit(HitBuilders.HitBuilder builder)
        {
            // Inject custom dimensions, if any have been set:
            foreach (var kvp in customDimensions)
            {
                // XXX: Workaround wrong signature for setCustomDimension in the component bindings:
                HitBuilderWorkaround.SetCustomDimension(builder, kvp.Key, kvp.Value);
            }
            customDimensions.Clear();

            tracker.Send(builder.Build());
        }
Esempio n. 3
0
            public static void SetCustomDimension(HitBuilders.HitBuilder builder, int index, string dimension)
            {
                if (HitBuilderSetCustomDimensionId == IntPtr.Zero)
                {
                    HitBuilderSetCustomDimensionId = Android.Runtime.JNIEnv.GetMethodID(HitBuilderClassRef, "setCustomDimension", "(ILjava/lang/String;)Lcom/google/android/gms/analytics/HitBuilders$HitBuilder;");
                }
                IntPtr dimensionPtr = Android.Runtime.JNIEnv.NewString(dimension);

                Android.Runtime.JNIEnv.CallObjectMethod(builder.Handle, HitBuilderSetCustomDimensionId, new Android.Runtime.JValue[] {
                    new Android.Runtime.JValue(index),
                    new Android.Runtime.JValue(dimensionPtr)
                });
                Android.Runtime.JNIEnv.DeleteLocalRef(dimensionPtr);
            }
Esempio n. 4
0
        static void SetUserIDDimension(HitBuilders.HitBuilder builder)
        {
            if (UserIdDimensionIndex > 0)
            {
                var userId = string.Empty;

                try
                {
                    userId = GATracker.Get("&uid");
                }
                catch (Exception obj)
                {
                    Console.WriteLine(obj.Message);
                }

                if (!string.IsNullOrEmpty(userId))
                {
                    builder.SetCustomDimension(UserIdDimensionIndex, userId);
                }
            }
        }