当前位置:网站首页>Service的两种状态形式
Service的两种状态形式
2022-08-11 06:44:00 【是小A】
启动状态(started)
当应用组件(如 Activity)通过调用 startService() 启动服务时,服务即处于“启动”状态。一旦启动,服务即可在后台无限期运行,即使启动服务的组件已被销毁也不受影响,除非手动调用才能停止服务, 已启动的服务通常是执行单一操作,而且不会将结果返回给调用方
绑定状态(bound)
特点:调用者与服务绑定在了一起,调用者一旦退出,服务也就终止,大有“不求同时生,必须同时死”的特点
当应用组件通过调用 bindService() 绑定到服务时,服务即处于“绑定”状态。绑定服务提供了一个客户端-服务器接口,允许组件与服务进行交互、发送请求、获取结果,甚至是利用进程间通信 (IPC) 跨进程执行这些操作。 仅当与另一个应用组件绑定时,绑定服务才会运行。 多个组件可以同时绑定到该服务,但全部取消绑定后,该服务即会被销毁
边栏推荐
- Tidb二进制集群搭建
- Redis + lua implements distributed interface current limiting implementation scheme
- C语言每日一练——Day02:求最小公倍数(3种方法)
- 每日sql:求好友申请通过率
- 数仓开发知识总结
- sql--Users who have purchased more than 3 times (inclusive) within 7 days (including the current day), and the purchase amount in the past 7 days exceeds 1,000
- 【sdx62】XBL设置共享内存变量,然后内核层获取变量实现
- unable to extend table xxx by 1024 in tablespace xxxx
- 下一代 无线局域网--强健性
- ROS 话题通信理论模型
猜你喜欢
随机推荐
【深度学习】什么是互信息最大化?
【Pytorch】nn.ReLU(inplace=True)
Douyin get douyin share password url API return value description
Spatial Pyramid Pooling -Spatial Pyramid Pooling (including source code)
软件测试基本流程有哪些?北京专业第三方软件检测机构安利
easyrecovery15数据恢复软件收费吗?功能强大吗?
daily sql - query for managers and elections with at least 5 subordinates
【@网络工程师:用好这6款工具,让你的工作效率大翻倍!】
Tidb二进制集群搭建
Taobao API common interface and acquisition method
Depth (relay supervision)
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
每日sql -用户两天留存率
Redis + lua implements distributed interface current limiting implementation scheme
Trill keyword search goods - API
6月各手机银行活跃用户较快增长,创半年新高
从何跟踪伦敦金最新行情走势?
每日sql - 判断+聚合
【LaTex-错误和异常】\verb ended by end of line.原因是因为闭合边界符没有在\verb命令所属行中出现;\verb命令的正确和错误用法、verbatim环境的用法
淘宝商品详情API接口