What Is Background Processing?

A background task refers to a process provided by the system that can run in the background. Even if the application has been suspended or is no longer running, the background task belonging to the application can continue to perform related operations silently. They are usually performed silently without interrupting the user's other work. Such tasks are called background tasks. In contrast, foreground tasks are visible to users.

The relationship between the background task and the application can be understood as the background task is a very independent component in the application. It does not run on the application's thread. The thread it runs is completely independent. The background task is separate from the foreground task. The difference is that the foreground task occupies the entire screen, and the user directly interacts with it: while the background task cannot interact with the user, the background task can still update the tile, toast, and lock screen And operation. Because the foreground interacts with the user, it uses all available system resources, including
Background tasks can run while the application is suspended. However, if the application is already suspended, it cannot run any code. So how do background tasks know when to run? Of course, a suspended application cannot start a background task. Background tasks are run by the operating system. They are associated with a trigger that tells the task to run, and they can be associated with an optional set of conditions. [2]
Each background task can notify its application of its task progress and completion. Of course, this information is only useful when the application is running. It is meaningless when the application is suspended and terminated, so the notification mechanism is unreliable, and the application should not request these notifications. Below is a brief description of how to enable these notifications. The best way to reliably transfer data between an application and its background tasks is to use package data settings or files. If both the application and its background tasks are running, one party can notify the other party of its change by calling the ApplicationData's SignalDataChanged method. [3]
For example, a text editing software that helps users edit text is performed in the foreground. If this software is done well, it is better to have the function of automatically saving files, so that after the system crashes suddenly, all the changes made by users are not wasted. This function of autosave is generally used as a background task. When it is executed, it does not disturb the user's other work.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?