Fix geth logs on Android 10

From now on geth logs are stored at
`/storage/emulated/0/Android/data/im.status.ethereum.debug/files/Download/geth.log`
because app cant write to `sdcard/Download/geth.log`
This commit is contained in:
Roman Volosovskyi 2020-02-27 13:58:25 +02:00
parent cb78293db7
commit 89535ea8fc
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 4 additions and 1 deletions

View File

@ -159,7 +159,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
}
private File getLogsFile() {
final File pubDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
final Context context = this.getReactApplicationContext();
// Environment.getExternalStoragePublicDirectory doesn't work as expected on Android Q
// https://developer.android.com/reference/android/os/Environment#getExternalStoragePublicDirectory(java.lang.String)
final File pubDirectory = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
final File logFile = new File(pubDirectory, gethLogFileName);
return logFile;