I want to send request from Client(Socket) to server with the interval of some time like maybe 5 minutes. Is there any workaround to achieve that. And the same thing is possible in Android or not ?
Asked
Active
Viewed 857 times
0
-
Yes, this is possible. Do you have a specific, answerable question? – Duncan Jones May 05 '14 at 18:37
2 Answers
0
Well, you can use a Timer or a Thread
new Thread(new Runnable() {
public void run() {
while (true) {
doStuff();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();

Tiago Engel
- 3,533
- 1
- 17
- 22
0
Yes you can achieve it using java.util.Timer and java.util.TimerTask.
Please have a look at below posts for samples: