DEV Community

Robin Alex Panicker
Robin Alex Panicker

Posted on

Reporting screen load delays in Android apps and iOS apps, and fixing them.

Think about this. Your user opens your mobile app, launches the first screen, and (s)he clicks to move to next screen. What (s)he expects is the new screen to appear or gradual graceful display using content animation. What if (s)he instead encounters a delay of few seconds before the second screen opens? That situation is enough for the user to be turned off from your app.

Let us see how we can handle the situation.

1. Handle the bug gracefully

Well, agree that you cannot always do a fool proof testing before you launch the app. But what you can do is to detect the bug in realtime and programmatically show a message apologising for the delay, and that you will get this issue fixed soon. That should calm down the user.

2. Identifying the root cause

To fix the issue what you will need is a chronological sequence of life cycle events of the Activity / Fragment in case of Android app and ViewController in case of iOS app. This will help to identify where exactly the delay happened. Once that is known you will be able to check what exactly is happening there. Some of the common causes are:

  • Database interactions.
  • Network calls to the API.
  • Third party interactions.
  • Thread blocked waiting for response from another thread.

3. Fixing screen load delays

Now that you have identified the root cause, fixing them is much easier. You just need to ensure such heavy operations are moved to a later stage of the screen lifecycle after the screen is properly loaded. Avoid doing any such operations in onCreate, onStart or onConfigurationChanged lifecycle events of the Activity in case of Android app. If it is an iOS app, move out any such code from loadView, viewWillAppear, viewWillLayoutSubviews or viewWillTransition events in ViewController.

Use your animation and screen design skills to handle the operations after screen load process is done.

4. How to detect the delay and collect data

Use an SDK / framework like Finotes ( which has the capability to detect the bug and report the lifecycle events along with timestamps. Also Finotes has a call back mechanism when a bug is detected and you can use this call back to show messages and execute graceful handling of the situation.

Here is a blog on how Finotes can be used to detect screen load delays in Android -

The capability is available in Finotes iOS framework as well.

Discussion (0)