位置: 编程技术 - 正文

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(“第二篇”)——安卓的体系结构(菜鸟学安卓逆向)

  • 应交增值税一般纳税人的账怎么做
  • 烟叶税计入什么
  • 库存股是什么科目的备抵
  • 两个公司发工资怎么交个税
  • 简易计税是否要申报个税
  • 已认证专票有误怎么回事
  • 固定资产清理费用为什么有进项税额
  • 免税商品进项增值税发票怎么做账
  • 临时用工工资税率怎么算
  • 非正常损失会计利润调整
  • 固定资产的净收益和净损失怎么计算
  • 视同销售税率如何确定?
  • 个人所得税中的股息红利应纳税额
  • 增值税起征点有啥用
  • 利润分配从哪里取数
  • 全年一次性奖金个税计算
  • 从2017年7月1日起到现在多少天
  • 运费抵扣增值税是什么意思
  • 个体工商户税务登记证需要什么资料
  • 当月开票一定要当月入账吗
  • 原始凭据
  • 支付工程款时有哪些费用
  • 项目顾问是什么意思
  • ios路由设计
  • 在公司预支费用怎么写单据
  • 攀岗的企业性质有哪些
  • 腾讯手游助手如何隐藏键位
  • 苹果14pro max价格
  • 股东变更股权转让未分配利益
  • wordpress抓取网页
  • 贵的u盘和便宜的有什么区别
  • express框架使用
  • 使用vue搭建项目
  • 计提投资者利润
  • gpt-3的功能
  • 计算机视觉算法
  • 小程序从入门到精通
  • 矿产资源补偿费是什么
  • 通过微信支付码能查到微信本人吗
  • 财政补助结转和财政补助结余
  • 工业企业变压器容量费用
  • 公司处置已使用4年多的汽车,怎么增值税申报
  • 临时售楼部招牌效果图
  • 内部往来科目设置在哪类下
  • 在记账过程中,可能发生各种各样的差错
  • 土地使用权属于无形资产吗
  • 存货周转次数越高好还是越低好
  • 销售暂估业务处理
  • 小规模纳税人购入货物收到增值税专用发票
  • 事业单位装修费账务处理
  • 验资 银行
  • 房地产企业什么时候停止预缴增值税
  • mac上的home键在哪
  • 如何创作图文并茂的图片
  • mac重装macos
  • mac安装win10键盘失灵
  • smOutlookPack.exe - smOutlookPack是什么进程 什么文件
  • win10家庭版系统怎么样
  • 怎么关闭win10系统
  • freebsd安装教程
  • node的fs模块
  • opengl 位图
  • nodejs stdin
  • shell按行读取文件存入数组
  • dos删除指定后缀文件
  • css中如何设置图片大小
  • elementui基于vue
  • jquery移动div到另一个div中
  • shell脚本实现文件重命名
  • javascript网页游戏制作教程
  • js的变量
  • JavaScript中void(0)的具体含义解释
  • jquery1.11.3
  • 现在小规模开专票多少钱
  • 江苏省无犯罪证明
  • 个人能拒绝公司上市吗
  • 中国农村信用社手机银行下载app
  • 进出口备案登记表是哪个部门发的
  • 深圳国委
  • 新余契税
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设