I am hoping there’s a cross-platform answer to maintain a timer going when the app is backgrounded.
I am making an attempt to make a strolling app for Android and iOS and the timer has to maintain monitor of how lengthy the consumer has walked and present that to the consumer anytime they convey the app out of the background.
I’ve Shiny 3.0, however in line with Allan Ritchie, Shiny will not do this. Can anybody assist? I’ve this code within the ViewModel.
non-public void RunTimer()
{
_dispatcher.StartTimer(TimeSpan.FromMilliseconds(100), () =>
{
_dispatcher.Dispatch(() =>
{
App.TotalRunningTime = DateTime.Now - App.CurrentWalkStartingDateTime - App.TotalPausedTime;
var hours = App.TotalRunningTime.Hours;
var minutes = App.TotalRunningTime.Minutes;
var seconds = App.TotalRunningTime.Seconds;
TimerText = String.Format("{0:00} : {1:00} : {2:00}", hours, minutes, seconds);
// StepsCount = DependencyService.Get<IStepCounter>().Steps;
});
return TimerRunning;
});