What is foreground and background on Android?

Asked

Viewed 19,503 times

3

I wonder what means first or second plan on Android.

2 answers

6

Are 2 of 5 levels of importance that Android uses to classify a process.
To determine which processes to maintain and which to terminate, the system attaches a level of importance to each process based on the running components and their state.

Android sets the following levels of importance:

  1. Foreground. - Process necessary for what the user is doing.

  2. Visible - Process that has no focus component, but can still affect what the user sees on the screen.

  3. Service - Processes that run a service that has been started with the method startService() and is not in one of the two highest categories.

  4. Background - Process that keeps an activity that is not currently visible to the user.

  5. Emptiness - Process that has no active application component.

In another context, "background"(background) can refer to code execution on a thread(worker thread) other than the main thread(main thread).

For more complete information see, in the documentation, the guide Processes and links.

5

Summary

In general, the App in foreground is that you see open on the mobile screen. Any and all kind of action/function in the foreground is finalized when you close the App.

Already in background are those executions of the App that does not have a visual interface. Some continue to work even after closing the App.

Detailed explanation

For example when you receive a notification, it is shown in the bar of status. There is a service in which it remains running that is responsible for the notification, even with its closed application.

When the application is running in the background, shall we say, it is running in background, where there is a service responsible for leaving the application in this mode. A Service or Service is an application component that can perform background operations and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.