Search code examples
xamarinxamarin.formsvisual-studio-app-center

Visual Studio App Center Analytics Not working for Xamarin Forms Android Project


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


Solution

  • 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.