What is the difference between a background and foreground service?

后端 未结 3 453
予麋鹿
予麋鹿 2020-12-13 17:27

I am currently writing my first Android application and I keep running into references to background and foreground services. Since I intend on using a service in my applica

3条回答
  •  一生所求
    2020-12-13 18:02

    Perhaps this will answer your question:

    A started service can use the startForeground API to put the service in a foreground state, where the system considers it to be something the user is actively aware of and thus not a candidate for killing when low on memory. By default services are background, meaning that if the system needs to kill them to reclaim more memory (such as to display a large page in a web browser), they can be killed without too much harm.

    More info can be found here

提交回复
热议问题