-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FileLogger added to check distance on still state, Speedlist deleted …
…due to error on long duration singlemode play, enlarged modal exit button on multimode room create
- Loading branch information
Showing
3 changed files
with
52 additions
and
14 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
android/RunUsAndroid/app/src/main/java/Logging/FileLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package Logging; | ||
|
||
import android.content.Context; | ||
import android.util.Log; | ||
|
||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
|
||
// save log to file in device | ||
// you can find log file in directory returned by context.getFilesDir() | ||
// you can navigate in folders of device in Android Studio -> View -> Tool Windows -> Device Explorer | ||
// context.getFilesDir() returns path "/data/data/com.example.runusandroid/files/phenotype_storage_info" | ||
|
||
public class FileLogger { | ||
|
||
public static void logToFileAndLogcat(Context context, String tag, String message) { | ||
// Log to Logcat | ||
Log.d(tag, message); | ||
|
||
// Log to a file | ||
try { | ||
File logFile = new File(context.getFilesDir(), "distance_log.txt"); | ||
FileOutputStream outputStream = new FileOutputStream(logFile, true); | ||
String logMessage = message + "\n"; | ||
outputStream.write(logMessage.getBytes()); | ||
outputStream.close(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters