diff --git a/android/sdremote/res/layout/activity_selector.xml b/android/sdremote/res/layout/activity_selector.xml index 6f4cfa158cd8..c5c734b78daf 100644 --- a/android/sdremote/res/layout/activity_selector.xml +++ b/android/sdremote/res/layout/activity_selector.xml @@ -9,19 +9,19 @@ android:layout_margin="10dip" android:orientation="vertical" > + + - - SEARCH_INTERVAL) { + String aString = "LOREMOTE_SEARCH\n"; + DatagramPacket aPacket = new DatagramPacket( + aString.getBytes(CHARSET), + aString.length(), + InetAddress.getByName("239.0.0.1"), + PORT); + mSocket.send(aPacket); + aTime = System.currentTimeMillis(); + for (Server aServer : mServerList.values()) { + if (System.currentTimeMillis() + - aServer.getTimeDiscovered() > 60 * 1000) { + mServerList.remove(aServer.getAddress()); + Intent aIntent = new Intent( + CommunicationService.MSG_SERVERLIST_CHANGED); + LocalBroadcastManager.getInstance( + mContext) + .sendBroadcast(aIntent); + + } + } + } + listenForServer(); } } catch (SocketException e) { @@ -135,6 +151,6 @@ public class ServerFinder { } public Server[] getServerList() { - return mServerList.entrySet().toArray(new Server[mServerList.size()]); + return mServerList.values().toArray(new Server[mServerList.size()]); } }