import static ro.ieval.fonbot.R.string.*;
import static ro.ieval.fonbot.Utils.toNonNull;
+import java.net.SocketTimeoutException;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
Log.d("LongPollRunnable", "Long polling started");
while(man.getActiveNetworkInfo() != null && man.getActiveNetworkInfo().isConnected())
try {
- runnable.run();
+ runnable.doRun();
+ } catch (final SocketTimeoutException e){
+ Log.d("LongPollRunnable", "Socket timeout, refreshing connection");
} catch (final Exception ex){
ex.printStackTrace();
+ break;
}
Log.d("LongPollRunnable", "Long polling stopped");
}
* Broadcast action: remove an ongoing event
*/
public static final String ACTION_DELETE_ONGOING="ro.ieval.fonbot.FonBotMainService.ACTION_DELETE_ONGOING";
- /** Broadcast action: trigger a server poll */
- public static final String ACTION_TRIGGER_POLL="ro.ieval.fonbot.FonBotMainService.ACTION_TRIGGER_POLL";
+
/**
* Extra: ongoing event id
*
longPollThread.start();
}
+ ExecutableRunnable.retryTasks();
+
final boolean runForeground=PreferenceManager.getDefaultSharedPreferences(this).getBoolean("foreground", false);
if(!runForeground)
stopForeground(true);