What's foreground and background on Android?

3

I would like to know what it means first or background on Android.

    
asked by anonymous 23.03.2017 / 02:32

2 answers

3

They 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 assigns each level a level of importance based on the components that are running and their state.

Android defines the following levels of importance:

  • Foreground. - Process required for what the user is doing.
  • Visible - A process that has no component in the foreground but can still affect what the user sees on the screen.

  • Service - Processes that execute a service that has been started with the startService() method and is not in one of the two highest categories.
  • Background - Process that maintains an activity that is not currently visible to the user.

  • Empty - Process that has no active application component.

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

    For more complete information, see the Processes and threads.

        
    23.03.2017 / 13:08
    3

    Briefly, in foreground , any type of action / function ends up closing when you end your application. As long as background , some events still work even after you've finished your application. For example when you receive a notification, it is displayed in the status bar. There is a service in which you remain running that is responsible for the notification, even with your application closed.

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

        
    23.03.2017 / 02:44