Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stream-log-android-file/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
>

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<application>

<service
android:name=".StreamLogFileService"
android:enabled="true"
android:exported="true"
android:foregroundServiceType="dataSync"
>

<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,18 @@ public class FileStreamLogger(
* This helper ensures safe creation of files by handling edge cases and logging issues to improve
* stability across all devices.
*/
if (!internalFile.exists()) {
try {
try {
if (!internalFile.exists()) {
internalFile.createNewFile()
}

if (internalFile.canWrite()) {
currentFile = internalFile
currentWriter = internalFile.fileWriter()
}
} catch (e: Exception) {
Log.e("FileInit", "Failed to create or write to file: ${internalFile.absolutePath}", e)
return
if (internalFile.canWrite()) {
currentFile = internalFile
currentWriter = internalFile.fileWriter()
}
} catch (e: Exception) {
Log.e("FileInit", "Failed to create or write to file: ${internalFile.absolutePath}", e)
return
}
}
}
Expand Down