android中的service和intentService有什么区别? [英] what is the difference between service and intentService in android ?

查看:333
本文介绍了android中的service和intentService有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在android中读到了一篇关于service&AsyncTask的文章。它解释了非交互式操作需要很长时间才能使用服务。之后它引入了IntentService而没有任何有用的解释!它只是说许多程序员忘记停止服务并且它会导致很多问题所以如果你想避免这个问题你应该使用IntentService! (这是什么意思?)

现在我想知道哪一个更好,这两个类之间的主要区别是什么

i read an article about service & AsyncTask in android . it explains for non interactive operations which take a long Time you have to use Service . after that it introduces IntentService without any useful Explanation ! it just only says many programmers forget to Stop Service and it causes a lot of problems so if you want to avoid this problems you should use IntentService !!! (what does it mean ? )
now i want to know which one is better and what is the main difference between this 2 classes

推荐答案

服务:它基本上是一个在后台运行的组件,无需与用户直接交互。它主要用于长时间运行。



示例:每次检查新的更新每天,fb和邮件通知。



IntentService:它用于在后台执行某些任务。一旦完成,IntentService的实例将自动终止。



示例:downloads
Service:It is basically a component which runs in the background witout direct interaction with the user.It's mostly used for long running operations.

Examples : Checking new updates every day,fb & mail notifications.

IntentService:It's used to perform certain task in the background.Once it's done,the instance of IntentService will be terminated by itself automatically.

Example : downloads


这篇关于android中的service和intentService有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆