IntentService是Service的子类,是一个异步的,会自动停止的服务,很好解决了传统的Service中处理完耗时操作忘记停止并销毁Service的问题优点:
一方面不需要自己去new Thread另一方面不需要考虑在什么时候关闭该ServiceonStartCommand中回调了onStart,onStart中通过mServiceHandler发送消息到该handler的handleMessage中去。最后handleMessage中回调onHandleIntent(intent)。
IntentService的使用场景与特点
最新推荐文章于 2020-11-29 14:42:42 发布