Internals of Android App Launch

Alvina Rasquinha
2 min readSep 1, 2023

--

Startup states

There are 3 states in which an android app can launch:

  1. Cold start
  2. Warm start
  3. Hot start

Cold start

This happens when the app starts from the scratch. ex: First time since the device booted or System killed the app and the app restarted. This state has the most overhead.

Steps that take place during the cold start are as below:

Part A: System process does the following:

  1. Load and launch the App
  2. Display a blank preview window (can be customised for branding)
  3. Create the App Process

Part B: App process does the following:

  1. Create App object
  2. Create and start the Main Thread
  3. Create the Main Activity
  4. Inflate the views
  5. Perform the first draw

Part C: After the first draw, the System Process swaps out the preview window with the Main Activity layout.

Warm start

This happens in the below scenarios:

  1. User presses the ‘Back’ to go to ‘Home’ screen. On relaunch, the activity may have to call ‘OnCreate’
  2. System removes the App from the memory , causing the App Process, Main Activity to be re-created. Some advantage may be present, due to the state saved in the bundle.

Hot start

This has the least overhead. This happens when the App is brought to foreground. If the Activity and related objects are still in memory, then object inits, layout inflation and rendering may not be necessary. But if some objects have been garbage collected, then they may have to be re-created.

This state has the similar behaviour as the cold start, wherein the preview window will be displayed to the user before the Main Activity screen is completely visible for interaction.

--

--

Alvina Rasquinha

Android, Flutter App Development | Competitive Programming