Closed munkii closed 1 week ago
Hi @munkii, thank you for reporting! Could you please tell us how AppCenter.Analytics is being started in the app? Where is called Appcenter.Start? Is App being put into background right after launch? I am asking because Analytics is trying to send start session event while initializing and after app is being put back to foreground.
We call it in Xamarin.Forms.Application OnStart
protected override void OnStart()
{
#if !RELEASE_LIVECONFIG
AppCenter.Start(
$"ios={AppSettings.AppCenterAnalyticsIosDevTest};" +
$"android={AppSettings.AppCenterAnalyticsAndroidDevTest}",
typeof(Analytics),
typeof(Crashes));
#else
AppCenter.Start(
$"ios={AppSettings.AppCenterAnalyticsIos};" +
$"android={AppSettings.AppCenterAnalyticsAndroid}",
typeof(Analytics),
typeof(Crashes));
#endif
base.OnStart();
Page pageToShow = null;
if (Xamarin.Essentials.VersionTracking.IsFirstLaunchEver == false)
{
pageToShow = FreshPageModelResolver.ResolvePageModel<HomeViewModel>();
}
else
{
pageToShow = FreshPageModelResolver.ResolvePageModel<FirstRunViewModel>();
}
var mainNavContainer = new FreshNavigationContainer(pageToShow, NavigationContainerNames.MainContainer);
this.MainPage = mainNavContainer;
App.Current.On<Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
}
Is App being put into background right after launch? To be honest I don't know.
Hi @munkii,
Thank you for the information you've shared. These two events not necessary happen simultaneously. There could be a gap between start of service log and start of session log when the app has been put in background between them. Start service log potentially couldn't be sent in time because of that.
Also do you use manual control of the session? Do you enable the following in your code:
Analytics.EnableManualSessionTracker();
https://learn.microsoft.com/en-us/appcenter/sdk/analytics/xamarin#manage-start-session
Closing due to inactivity.
Gaps between StartSessionLog call and StartSessionLog call from 55mins to 11hours with nothing logged in between Description
Please describe the issue you are facing using the SDK.
Repro Steps
Please list the steps used to reproduce your issue.
Details
Whilst investigating some odd behvior where our app was sending expired Azure B2C Access Tokens we were macthing the failed requests to AppCenter logs. Of the 8 occurences of this expired token issue i can match them to 6 failures in the AppCenter logs
They are all iOS users but that could be a coincidence
In the logs i see something like this each time
Note the 55minute gap between one log 'ViewModel - HomeViewModel Appearing' and the 'StartSessionLog'. I have seen one occurence where the gao to StartSesssionLog was 11hours