Пример #1
0
    void Start()
    {
        // Initialize Flurry once.
        new Flurry.Builder()
        .WithCrashReporting(true)
        .WithLogEnabled(true)
        .WithLogLevel(Flurry.LogLevel.LogVERBOSE)
        .WithAppVersion("1.0")
        .Build(FLURRY_API_KEY);

        // Example to get Flurry versions.
        Debug.Log("AgentVersion: " + Flurry.GetAgentVersion());
        Debug.Log("ReleaseVersion: " + Flurry.GetReleaseVersion());

        // Set users preferences.
        Flurry.SetAge(36);
        Flurry.SetGender(Flurry.Gender.Female);
        Flurry.SetReportLocation(true);

        // Log Flurry events.
        Flurry.EventRecordStatus status = Flurry.LogEvent("Unity Event");
        Debug.Log("Log Unity Event status: " + status);

        // Log Flurry timed events with parameters.
        IDictionary <string, string> parameters = new Dictionary <string, string>();

        parameters.Add("Author", "Flurry");
        parameters.Add("Status", "Registered");
        status = Flurry.LogEvent("Unity Event Params Timed", parameters, true);
        Debug.Log("Log Unity Event with parameters timed status: " + status);

        Flurry.EndTimedEvent("Unity Event Params Timed");
    }
Пример #2
0
    void OnGUI()
    {
        GUILayout.BeginVertical();

        if (GUILayout.Button("Start Flurry", GUILayout.Height(60)))
        {
            flurry.StartSession(FLURRY_API_KEY);
        }
        if (GUILayout.Button("Agent Version", GUILayout.Height(60)))
        {
            Debug.Log("Agent version is " + flurry.GetAgentVersion());
        }
        if (GUILayout.Button("Log Event 1", GUILayout.Height(60)))
        {
            flurry.LogEvent("Event 2");
        }
        if (GUILayout.Button("Log Event 1 with params", GUILayout.Height(60)))
        {
            Dictionary <string, string> kvps = new Dictionary <string, string>();
            kvps.Add("GameName", "MyGame");
            kvps.Add("Level", "Level1");
            flurry.LogEvent("Event 3", kvps);
        }

        if (GUILayout.Button("Timed Log Event 1 with params", GUILayout.Height(60)))
        {
            Dictionary <string, string> kvps = new Dictionary <string, string>();
            kvps.Add("GameName", "MyGame");
            kvps.Add("Level", "Level1");
            flurry.LogEvent("Timer 2", kvps, true);
        }

        if (GUILayout.Button("Timed Event Start", GUILayout.Height(60)))
        {
            Dictionary <string, string> kvps = new Dictionary <string, string>();
            kvps.Add("TGameName", "MyGame");
            kvps.Add("TLevel", "Level1");
            flurry.LogEvent("Timer 2", kvps, true);
        }

        if (GUILayout.Button("Timed Event End", GUILayout.Height(60)))
        {
            flurry.EndTimedEvent("Timer 2");
        }

        if (GUILayout.Button("End Session", GUILayout.Height(60)))
        {
            flurry.EndSession();
        }

        GUILayout.EndVertical();
    }
Пример #3
0
    void Start()
    {
        // Note: When enabling Messaging, Flurry Android should be initialized by using AndroidManifest.xml.
        // Initialize Flurry once.
        new Flurry.Builder()
        .WithCrashReporting(true)
        .WithLogEnabled(true)
        .WithLogLevel(Flurry.LogLevel.VERBOSE)
        .WithMessaging(true)
        .WithPerformanceMetrics(Flurry.Performance.ALL)
        .Build(FLURRY_API_KEY);

        // Example to get Flurry versions.
        Debug.Log("AgentVersion: " + Flurry.GetAgentVersion());
        Debug.Log("ReleaseVersion: " + Flurry.GetReleaseVersion());

        // Set user preferences.
        Flurry.SetAge(36);
        Flurry.SetGender(Flurry.Gender.Female);
        Flurry.SetReportLocation(true);

        // Set user properties.
        Flurry.UserProperties.Set(Flurry.UserProperties.PROPERTY_REGISTERED_USER, "True");

        // Set Messaging listener
        Flurry.SetMessagingListener(new MyMessagingListener());

        // Log Flurry events.
        Flurry.EventRecordStatus status = Flurry.LogEvent("Unity Event");
        Debug.Log("Log Unity Event status: " + status);

        // Log Flurry timed events with parameters.
        IDictionary <string, string> parameters = new Dictionary <string, string>();

        parameters.Add("Author", "Flurry");
        parameters.Add("Status", "Registered");
        status = Flurry.LogEvent("Unity Event Params Timed", parameters, true);
        Debug.Log("Log Unity Event with parameters timed status: " + status);
        // ...
        Flurry.EndTimedEvent("Unity Event Params Timed");
    }