From the various sources of information I collect, this becomes very important for any beginner Android Developer, because by knowing the application lifecycle, we can easily design and develop applications on Android later. Easy examples like this, such as chat apps on the side, we can add to move from one feature to another such as adding a chat or viewing a person's complete profile. When we press the profile button, the application will direct us to a new page containing the detail profile of someone. Well, every page is an easy example of the application lifecycle on Android, it is one example of Android lifecycle.
And when we close the app with just the back / home button, the application is still running in memory. This is what makes the app run faster when we access it again. But it also makes other applications slow down if too many open applications that use memory. Because memory in Android is generally limited, so the Android system will automatically close the application based on its priority, as shown in the table below.
An application in which the user is interacting with an activity, or which has an service which is bound to such an activity. Also if a service is executing one of its lifecycle methods or a broadcast receiver which runs its onReceive()method.
User is not interacting with the activity, but the activity is still (partially) visible or the application has a service which is used by a inactive but visible activity.
Application with a running service which does not qualify for 1 or 2.
Application with only stopped activities and without a service or executing receiver. Android keeps them in a least recent used (LRU) list and if requires terminates the one which was least used.
Application without any active components.
All application processes that are in the 'Empty' status will be the last queue. If an app that is in 'Foreground' status has force close or otherwise, the priority of the application in the 'Empty' status will be raised, as well as others, as shown in the graph below.
The Android system will kill / terminate the application with low priority if the system requires additional space. The following video can also help explain what LRU Cache is and how it works LRU Cache on Android.