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.