位置: 编程技术 - 正文

android-service(androidserviceslibrary停用)

编辑:rootadmin

推荐整理分享android-service(androidserviceslibrary停用),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:androidserviceslibrary是什么应用,androidservice停止运行怎么办,androidserviceslibrary是什么应用,androidserviceslibrary删除,androidservice下载,androidserviceslibrary是什么应用,androidserviceslibrary是什么应用,androidserviceslibrary是什么,内容如对您有帮助,希望把文章链接给更多的朋友!

service 和线程有什么关系?有什么区别?

1.没关系。service不线程。

Services

A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application. Additionally, a component can bind to a service to interact with it and even perform interprocess communication (IPC). For example, a service might handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background.

Service 是一个应用组件。它在后台提供长时间的操作,不提供UI。其他的组件可以开启service,即使切换到其他的应用,service还是会在后台继续运行。此外,一个组件可以绑定一个service来与其交互,甚至可以实现跨进程的通信。例如,一个service可以处理网络事务,播放音乐,执行文件I/O操作,和内容提供者交互,所有这些都是在后台执行的。

A service can essentially take two forms:

StartedA service is "started" when an application component (such as an activity) starts it by calling startService(). Once started, a service can run in the background indefinitely, even if the component that started it is destroyed. Usually, a started service performs a single operation and does not return a result to the caller. For example, it might download or upload a file over the network. When the operation is done, the service should stop itself.android-service(androidserviceslibrary停用)

一个应用组件可以通过startService()开启service。 一旦start,service就在后台无限期的执行,即使组件被销毁。通常,一个开启的service执行单独的操作,不会给调用者返回&#;。例如,下载或上传文件到网络。当操作结束时,service自动停下来。

BoundA service is "bound" when an application component binds to it by calling bindService(). A bound service offers a client-server interface that allows components to interact with the service, send requests, get results, and even do so across processes with interprocess communication (IPC). A bound service runs only as long as another application component is bound to it. Multiple components can bind to the service at once, but when all of them unbind, the service is destroyed.一个应用组件可以通过 bindService()来绑定service。绑定的service提供一个客户端-服务器的接口,就是说组件作为客户端与service服务器端进行交互。比如 发送请求,得到结果,甚至完成跨进程的通信。一个 bound service只要有一个组件绑定到它,就会运行。一次可以有很多组件绑定到它,当所有组件都解出绑定时,service才被销毁。

Although this documentation generally discusses these two types of services separately, your service can work both ways—it can be started (to run indefinitely) and also allow binding. It's simply a matter of whether you implement a couple callback methods:onStartCommand() to allow components to start it and onBind() to allow binding.

虽然文档通常时区分他们,来谈论这两种service。但是你的service可以同时工作在这两种方式既可以bind 也可以 start。这仅仅是你是否实现这两个回调函数的问题,:onStartCommand() (组件start它) and onBind() (组件bind它).

Regardless of whether your application is started, bound, or both, any application component can use the service (even from a separate application), in the same way that any component can use an activity—by starting it with an Intent. However, you can declare the service as private, in the manifest file, and block access from other applications. This is discussed more in the section about Declaring the service in the manifest.

不管你的应用是started,bound还是包含两者,任何应用组件都可以使用它(即使来自别的应用)。和使用activity一样,使用service也是通过Intent。但是,你也可以在清单文件里声明service是私有的,这会阻止其他应用的访问。

Caution: A service runs in the main thread of its hosting process—the service does not create its own thread and does not run in a separate process (unless you specify otherwise). This means that, if your service is going to do any CPU intensive work or blocking operations (such as MP3 playback or networking), you should create a new thread within the service to do that work. By using a separate thread, you will reduce the risk of Application Not Responding (ANR) errors and the application's main thread can remain dedicated to user interaction with your activities.

注意:service 运行在宿主进程的主线程中,它不会创建自己的进程,不会不运行在独立的进程里(除非你指定)。这就是说,如果你的service执行任何CPU紧张的工作或者阻塞操作,你应该在service里创建新的线程。通过使用新的线程,你可以降低ADR的风险,使你的activities 专注于用户交互。

菜鸟学安卓Log.v(“第二篇”)——安卓的体系结构 安卓的体系结构图:上面就是一个安卓体系的图,大概要了解一下,红色部分是安卓体系结构的最底层,驱动层(具体驱动层真正的内容我目前不是很清

无线adb调试 要求:1.要求手机已经root了2.android端与PC端在同一个局域网中。步奏:1.android端下载并安装adbWireless(传送门)2.android端,打开adbWireless,点击中间的按钮开

WIN7、WIN8打开命令行Cmd窗口 一、Win7系统大家习惯WinR的组合键打开运行,然后输入CMD打开命令提示符。二、一般打开菜单是没有打开命令行的如下图进入某个文件夹里面,先按住Shi

标签: androidserviceslibrary停用

本文链接地址:https://www.jiuchutong.com/biancheng/374562.html 转载请保留说明!

上一篇:Android UI简介(android的ui组件有哪些)

下一篇:菜鸟学安卓Log.v(“第二篇”)——安卓的体系结构(菜鸟学安卓逆向)

  • 药酒消费税计税依据
  • 个税申报缴费
  • 收到没有填税号的短信
  • 万元版和十万元版可以一起用吗
  • 非正常损失计入哪里
  • 土地转让缴纳增值税政策
  • 材料成本差异会计
  • 长期股权投资顺流交易固定资产
  • 用友u8怎样查询上个月凭证
  • 自然灾害造成库存商品毁损
  • 行政单位无法支付怎么办
  • 融资租赁中承租人的权利
  • 免税农产品收入是否计入30万销售额
  • 小规模纳税人补缴增值税
  • 关联业务报告表需要填吗
  • 融资租赁的房产,按收取的租金从租计征房产税
  • 资本溢价公积金计算公式
  • 清包工有措施费吗
  • 消费税如何避税计算
  • 长期债权投资业务处理
  • 办税员可以增加办税员吗
  • 购进商品是什么会计科目
  • 王者荣耀通用铭文狩猎和隐匿
  • 鸿蒙系统怎么看运行程序
  • 电脑进入bios关机
  • ’sass_binary_site‘ is not a valid npm option问题的产生原因及解决办法
  • 企业获得境外咨询费
  • 应收账款净额可以是负数吗
  • 若依移动端微信登录
  • 为什么结转各项支出时本年利润在借方
  • 污水处理增值税税率
  • 销项税的分录怎么做
  • php魔术方法autoload
  • 金融机构存放的保证金存款
  • 待摊费用在资产负债表中怎么表示
  • 豪华车消费税的计算公式
  • 减按10的税率征收个人所得税
  • mysql union or
  • 织梦如何使用
  • 固定资产不折旧不摊销怎么做账
  • MYSQL5 masterslave数据同步配置方法第1/3页
  • 无形资产摊销年限按法律规定还是企业估计
  • 公司把股权转让给个人员工该怎么办
  • 会计差错更正的会计处理方法
  • 企业的借款利息费用,扣除标准是?
  • 怎么调整应收账款分录
  • 股权转让如何缴纳个人所得税举例说明
  • 成本法和权益法的转换
  • 残保减免金政策
  • 企业给员工租的公寓
  • 欠别人钱是否可以起诉
  • 如何计提五险一金比例
  • 会计凭证要保存多少年企业注销
  • 饭店会计做账流程
  • 通过MySQL优化Discuz!的热帖翻页的技巧
  • sql 常用语录
  • sqlserver跨库查询sql回路问题
  • 联想s5s531笔记本M2
  • awk命令的功能是什么
  • PRISMSVR.EXE - PRISMSVR是什么进程 有什么用
  • win10累积更新是什么意思
  • cocos2dx游戏有哪些
  • 对于cookie的描述
  • 表单提交servlet
  • CCClippingNode导致的贴图错误问题
  • js获取页面元素的方法
  • 文档对象模型DOM主要作用是
  • jQuery的 $.ajax防止重复提交的两种方法(推荐)
  • 手机android版本强制升级
  • Zero Clipboard实现浏览器复制到剪贴板的方法(多个复制按钮)
  • 南京税务局是地市级还是副省级
  • 快递代缴的关税有税单吗
  • 内蒙古网上税务登记流程
  • 沈阳市税务局全称
  • 税务系统领发票
  • 电子税务局网页版
  • 北京身份证网上换证流程
  • 中关村税务所上班时间
  • 税收助力双创
  • 辽宁网上税务
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设