MainThread.BeginInvokeOnMainThread(() => { Application.Current?.Dispatcher?.StartTimer(TimeSpan.FromSeconds(2), () => { doubleBackToExitPressedOnce = false; return false; // Stops the timer after execution }); });
This perfectly worked for me .NET MAUI