您的位置:首页 > 其它

IntentService源码分析

2015-12-03 18:22 411 查看


实现思路

thread + handler
暴露唯一接口onHandleIntent给子类实现
消息队列保证任务的顺序性
巧妙的自动退出机制,其关键点

stopSelf(int startId), Stop the service if the most recent time it was started was <var>startId</var>.

onStartCommand(Intent intent, int flags, int startId), startId is A unique integer representing this specific
 request to start. Use with {@link #stopSelfResult(int)}.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: