2
votes

I am using Visual Studio App Center for my Xamarin Forms Android Application for capturing the Analytics(Events and Crashes)

I am configuring crashes and analytics in OnStart of my App.Xaml.cs

AppCenter.Start($"android={Settings.Current.AppCenterAnalyticsAndroid};" +
typeof(Analytics), typeof(Crashes));

And for invoking the Events I am calling the below Method.

public void TrackEvent(string name, Dictionary<string, string> properties = null)
{
       Analytics.SetEnabledAsync(true).ConfigureAwait(false);
       Analytics.TrackEvent(name, properties);
}

Crashes are logging correctly in App Center But the events are not. Also I can see the corresponding entries in Log Flow

2
Just a wild guess, but from the docs: "Also, there is a maximum limit of 256 characters per event name and 125 characters per event property name and event property value." Maybe this is happening?Gerald Versluis
I am only passing status keys like this "Status confirm Page :: Dismiss pop up "StezPet

2 Answers

6
votes

Your app secret string is invalid because it contains + typeof(Analytics), it should be , typeof(Analytics).

Since you used the android key/value delimiter we could extract the appSecret and make it work with Crashes, but typeof(Analytics) ended up in the wrong appSecret parameter string.

1
votes

You shouldn't need to add Analytics.SetEnabledAsync(true).ConfigureAwait(false);

Simply Call Analytics.TrackEvent(name, properties); (it doesn't need to be in a task anyways. I track my events in the Construtor of pages, for example.

Also, when you run the application, you get a debug Message confirming that AppCenter has been configured correctly, check if that is the case.

And, it may take a while, for them to appear in the Events.