Forum Xamarin.Android

Why would OnPause and OnResume get called while the app is still the currently active app?

TimothyTimothy USUniversity ✭✭
edited January 2019 in Xamarin.Android

I'm running into an oddity where the OnPause and OnResume methods are being called after the app has been sitting, unused, for about 55-60 seconds or so. The screen isn't locking and the app isn't being backgrounded. It calls the OnPause method followed immediately by a OnResume call. Now this is a problem for the application because it's not uncommon to leave the app running on the phone. Much of the functionality limits what a user is able to do until the GPS has been able to accurately assess their location and detect that they are within a certain range of a pre-determined location. For some phones this can take a while, especially if they don't have a particularly good signal. When OnResume gets executed, it performs a couple of tasks to check some things and a loading screen is displayed. What ends up happening now is the loading screen is presented to the user after 20 seconds or so not doing anything. Depending on the connection, it can take a minute for everything to be analyzed and the loading screen to go away. I won't go into detail but this delay can present some problems for the user.

It's worth noting that we recently updated the SDK and are in the process of updating the APP to work with the latest tools. I don't recall anything like this occurring before the update. Is this normal behavior for Android?

Best Answer


  • TimothyTimothy USUniversity ✭✭

    Well, after doing some testing, it only appears to do this twice back to back after the initial 55-60 seconds wait. I can then wait and it doesn't happen again. If I background the app and bring it back up, it will do the same thing after the initial wait period and then do not do it again.

Sign In or Register to comment.