I need to log "Some text" in the devices storage after every 5 minutes can some one point me to the best way to do this. But i do not want the main thread to freeze and the logging thread should be alive all the time. I tried this but it seems to freeze my emulator is there a better way to do the same
public class DataWriteService extends Service {
private FileIOHelper fileHelper= new FileIOHelper("Test.txt");
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//Gets location and writes to a file
fileHelper.writeToFile(this, "Some text");
return START_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
}
}