Android的:如何在后台服务定期运行的AsyncTask

Android的:如何在后台服务定期运行的AsyncTask

问题描述:

我如何运行的AsyncTask 在在后台服务10次2分钟的睡眠周期定时?

How do I run an AsyncTask at regular interval of 2 mins sleep for 10 times in the background service?

作为VM在任何时间停止我的服务,我的的AsyncTask 也越来越封闭。

As VM stops my service at any time, my AsyncTask is also getting closed.

我曾尝试的ScheduledThreadPoolExecutor 定时的TimerTask 所有被暂时停止服务被停止。

I have tried ScheduledThreadPoolExecutor, Timer, TimerTask all gets stopped once Service gets stopped.

有一个很好的选择开始?

Is there a good option start with?

任何帮助是AP preciated。

Any help is appreciated.

你试过处理程序? ü可以阅读更多关于这此的链接

Have you tried the Handler? U can read more about this in this link