Commit 50eda989 authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

make file readable by user

parent deac7849
...@@ -21,6 +21,7 @@ import java.lang.Thread.UncaughtExceptionHandler; ...@@ -21,6 +21,7 @@ import java.lang.Thread.UncaughtExceptionHandler;
* @author Vincent Bourgmayer * @author Vincent Bourgmayer
*/ */
public class ServiceExceptionHandler implements UncaughtExceptionHandler{ public class ServiceExceptionHandler implements UncaughtExceptionHandler{
private final static String TAG = ServiceExceptionHandler.class.getSimpleName();
private UncaughtExceptionHandler defaultUEH; private UncaughtExceptionHandler defaultUEH;
Service service; Service service;
...@@ -39,12 +40,19 @@ public class ServiceExceptionHandler implements UncaughtExceptionHandler{ ...@@ -39,12 +40,19 @@ public class ServiceExceptionHandler implements UncaughtExceptionHandler{
//Create a new file that user can sent to us //Create a new file that user can sent to us
String fileName = "eDrive-crash-"+timestamp+".log"; String fileName = "eDrive-crash-"+timestamp+".log";
File downloadDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath());
File downloadDir = service.getApplication().getExternalFilesDir("Logs");
//File downloadDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath());
File logFile = new File(downloadDir, fileName); File logFile = new File(downloadDir, fileName);
try { try {
FileOutputStream fos = new FileOutputStream(logFile); FileOutputStream fos = new FileOutputStream(logFile);
fos.write(getStackTraceAsString(e).getBytes()); fos.write(getStackTraceAsString(e).getBytes());
fos.close(); fos.close();
logFile.setReadable(true, false);
//DID NOT WORKS: CommonUtils.doActionMediaScannerConnexionScanFile(service, logFile.getCanonicalPath());
} catch (IOException exception) { } catch (IOException exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment