我目前正在编写我的第一个Android应用程序,并且不断遇到对后台和前台服务的引用.由于我打算在我的应用程序中使用服务,所以我希望在两者之间以及它们的使用方式之间进行说明.
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 application I was hoping to get a clarification between the two and how they are used.
推荐答案也许这会回答您的问题:
Perhaps this will answer your question:
启动的服务可以使用startForeground API放置服务 在前台状态下,系统认为它是某物 用户积极地意识到,因此不是杀人的候选人 当内存不足时.默认情况下,服务是后台的,这意味着 如果系统需要杀死它们以回收更多内存(例如 在网络浏览器中显示一个大页面),就可以将其杀死 伤害很大.
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.
可以在此处
更多推荐
后台服务和前台服务有什么区别?
发布评论