i have long-running process implemented service. start service activity using startservice , bindservice , unbindservice in onstop() method. service uses timer parse xml , download assets , has potential run while.
here's problem: fc when close activity , timer running. seems when posting http fc happens. ideas? services have independent of activities , contain no references them?
private void startservice() { final handler handler = new handler(); final runnable runnable = new runnable() { public void run() { if(!isrunning) { isrunning = true; log.v(tag, "running download task"); fgapp.getcdninfo(true, false); } else { isrunning = false; log.v(tag, "download task running"); } } }; timer = new timer(); timer.scheduleatfixedrate(new timertask() { public void run() { handler.post(runnable); } }, 1000, delay); }
Comments
Post a Comment