Quellcode durchsuchen

wifi_direct: now searching for new devices every 5s

Fabio Arnold vor 9 Jahren
Ursprung
Commit
d33a437b5c

+ 9 - 0
src/de/tudarmstadt/informatik/hostage/sync/wifi_direct/ui/WiFiP2pSyncActivity.java

@@ -25,6 +25,8 @@ import android.widget.ViewAnimator;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
 
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.sync.wifi_direct.BackgroundTask;
@@ -116,6 +118,13 @@ public class WiFiP2pSyncActivity extends Activity implements AdapterView.OnItemC
         this.registerListeners();
 
         this.wifiEventHandler().startService();
+
+		new Timer().scheduleAtFixedRate(new TimerTask() {
+			@Override
+			public void run() {
+				searchForDevices();
+			}
+		}, 1000, 5000); // search for devices every 5 seconds
     }
 
     @Override