Please review steps 1 & 2 if approch is correct. Also, suggest how to code step 2.
Problem Statement:
1. Start a ongoing thread to capture status of the application.
Thread thread = new Thread() {
public void run() {
while (true) {
try {
checkStaus();
Thread.sleep(TIMER); // 1 mins
} catch (InterruptedException e) {
Log.e("MyService", "local Thread error", e);
}
}
}
};
thread.start();
2. When 10 mins has been passed, send the captured logs to server.
Pseudo:
a. Maintain counter until it reaches 600000 milliseconds (10 mins)
b. Start an async task to send captured logs to server.
c. After successful sending of file, reset counter; empty log file and continue capturing logs.
Thanks