后台服务和前台服务有什么区别?

编程入门 行业动态 更新时间:2024-10-27 04:26:20
本文介绍了后台服务和前台服务有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前正在编写我的第一个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.

可以在此处

更多推荐

后台服务和前台服务有什么区别?

本文发布于:2023-11-27 05:02:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636709.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么区别   前台   后台

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!