views:

24

answers:

2

hi expert, i did wifi scanning for android, but now i want this wifi scanning run at set interval period, how this can be done, can any provide any snippets,

thanks in advance

+1  A: 

Use a Timer
http://developer.android.com/reference/java/util/Timer.html

Create a background service which holds the Timer, and call scheduleAtFixedRate

Matty F
A: 

hi all, i found answer my question, just simple declare below before onCreate TimerTask scanTask; final Handler handler = new Handler(); Timer t = new Timer();

write below on onCreate scanTask = new TimerTask() { public void run() { handler.post(new Runnable() { public void run() { startScanning(); //here where u want to call the method } }); }}; t.schedule(scanTask, 300, 5000); // here is t.schedule( , delay, period);

thats it

Apache