How long does it take to switch to OnStop while the app is in the background on Xamarin Forms?

Pelin Konaray 291 Reputation points
2020-12-03T15:44:24.523+00:00

Hi,

I have a xamarin forms app. When I go back from it, it goes OnPause(). After a while I open it, it starts from OnResume(). But when i keep the app in the background for a long time, it goes OnStop() and when I open it, it starts from OnStart(). I would like to know how long it will take to switch to OnStop? I searched time and I didn't find anything. Does this time change according to the device?

Thank you in advance.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,283 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 67,631 Reputation points Microsoft Vendor
    2020-12-04T03:12:52.907+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Does this time change according to the device?

    Yes, but not completely, If you do not have any forground service or Other services, no high priority Firebase Cloud Message (FCM) to invoke your application. Just keep your application to background, If your device's RAM is lower and need to open other task, your application will be killed quickly, then you open your application, it will sarts from start(), if the device's RAM is enough, your application will keep the background‘s time a little longer. If you use an forground service in Android, it will keep the application always in the background normally, it will starts from OnResume().

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful