我应该使用的AsyncTask或IntentService我的应用程序? [英] Should I use AsyncTask or IntentService for my application?

查看:135
本文介绍了我应该使用的AsyncTask或IntentService我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在读围绕互联网连接与Android,发现有不同的方式来处理这也就是AsyncTask的和IntentService。不过,我仍然不知道哪一个使用。我的应用程序基本上是一个位置/路径查找器与谷歌地图。我的互联网连接性将被用来查找映射的一个特定半径范围内最接近的路径。这样,每一个用户移动或刷卡地图到新位置的时间,然后,将与最接近的路径更新。这也将增加一个新的线索,并允许用户速率的线索。

I have been reading around on internet connectivity with Android and noticed there are different ways to handle this i.e. AsyncTask and IntentService. However, I'm still not sure which one to use. My application is basically a location/trails finder with Google Maps. My internet connectivity will be used to find the nearest trails within a certain radius of the map. So, every time a user moves or swipes the map to a new location then it will update with the nearest trails. It will also add a new trail, and allow the user to rate a trail.

威尔的AsyncTask满足这个还是我应该使用IntentService?

Will AsyncTask suffice for this or should I use IntentService?

推荐答案

您应该使用的AsyncTask 对于紧密绑定到一个活动的短期重复性的任务,就像你重目前正在努力做的事情。 IntentService 是对计划任务的详细齿轮(重复或没有)应该运行在后台,独立的活动。

You should use an AsyncTask for short repetitive tasks that are tightly bound to an activity, like what you're currently trying to do. IntentService are more geared towards scheduled tasks (repetitive or not) that should run on the background, independent of your activity.

这篇关于我应该使用的AsyncTask或IntentService我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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