|
@@ -14,6 +14,7 @@ import android.hardware.SensorEventListener;
|
14
|
14
|
import android.hardware.SensorManager;
|
15
|
15
|
import android.os.IBinder;
|
16
|
16
|
import android.util.Log;
|
|
17
|
+import android.widget.Toast;
|
17
|
18
|
import java.io.FileNotFoundException;
|
18
|
19
|
import java.io.FileOutputStream;
|
19
|
20
|
import java.io.IOException;
|
|
@@ -41,6 +42,7 @@ public class SensorLoggerService extends Service {
|
41
|
42
|
writer.write(System.currentTimeMillis() + ":" +
|
42
|
43
|
event.values[0] + "," + event.values[1]
|
43
|
44
|
+ "," + event.values[2] + "\n");
|
|
45
|
+ Toast.makeText(getApplicationContext(), "New values!", Toast.LENGTH_SHORT).show();
|
44
|
46
|
} catch (IOException ex) {
|
45
|
47
|
|
46
|
48
|
}
|
|
@@ -64,7 +66,7 @@ public class SensorLoggerService extends Service {
|
64
|
66
|
super.onStart(intent, startId);
|
65
|
67
|
|
66
|
68
|
try {
|
67
|
|
- stream = openFileOutput("sensors.log", MODE_APPEND | MODE_PRIVATE);
|
|
69
|
+ stream = openFileOutput("sensors.log", MODE_APPEND | MODE_WORLD_READABLE);
|
68
|
70
|
writer = new OutputStreamWriter(stream);
|
69
|
71
|
} catch (FileNotFoundException ex) {
|
70
|
72
|
return;
|