Friday, May 8, 2015

Working more with sockets and runnables (5/8/15)

Today I worked on a Runnable class for my Android app that sends data every 10 seconds. I added some methods to cancel and start it as well, but I haven't been able to test them yet. This method will allow me to continuously send data when I need to, and cancel it when I need to stop [onAppClosed, etc.]. It uses the CountDownTimer interface for Android to handle this.
public static void startSendingData(boolean start){
if(start){
new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
// Send Data via socket.io
}
public void onFinish() {
startSendingData(true);
}
}.start();
}
else {
// this.cancel(); or similar
}
}
view raw gistfile1.java hosted with ❤ by GitHub
I also worked a bit on planning and pulling the repo for the expo tomorrow, and doing some planning on how our internet connection, etc. will work.

No comments:

Post a Comment