0

I recently started working in Xamarin forms and quite happy to be part of Xamarin community. I've a requirement to kick out the loggedIn User if he is idle on app for 10 mins. I got through of it in Android part using usual Life Cycle methods (combination of OnResume/OnPause) but not yet succeeded in iOS app.

I've hard time trying to find a solution over the internet but not able to find the one so far. I also tried with using Some Life cycle methods like WillEnterForeground/DidEnterbackground but due to some reason these method are not invoked on desired actions.

FYI, I am from the Android background so not expertise in iOS. Any help would be highly appreciated or let me know If I am missing anything.

1 Answers1

0

in App class

DateTime sleepTime;
protected override void OnSleep()
{
    base.OnSleep();
    sleepTime = DateTime.Now;
}

protected override void OnResume()
{
    base.OnResume();
    var sleepDuration = DateTime.Now - sleepTime;
}
eakgul
  • 3,658
  • 21
  • 33