App logout when goes back to background

tinglitingli ✭✭USUniversity ✭✭

Hey All,

My Xamarin.Forms application has a login requirement, and each time when the app goes to background, it should count down 3 or 5 mins then automatically logout. So can I make a timer in OnSleep function or any other ways can achieve that?



Best Answer


  • JimBennettJimBennett ✭✭✭✭ GBXamarin Team, Insider, University, Developer Group Leader ✭✭✭✭

    Does it need to do anything to log out? If not could you not store the time when the app enters the background, and when it enters the foreground check this and if it's more than x minutes then require another login?

  • tinglitingli ✭✭ USUniversity ✭✭

    Hey Jim,

    This is pretty much a smart answer, but just wondering if there is a "right" way to do it?

  • tinglitingli ✭✭ USUniversity ✭✭

    @rene_ruppert Thanks

Sign In or Register to comment.