diff --git a/GNSSLogger/app/src/main/AndroidManifest.xml b/GNSSLogger/app/src/main/AndroidManifest.xml
index a6441be..985c1b4 100644
--- a/GNSSLogger/app/src/main/AndroidManifest.xml
+++ b/GNSSLogger/app/src/main/AndroidManifest.xml
@@ -19,5 +19,14 @@
+
+
+
diff --git a/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java b/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java
index eb4e138..2502bc5 100644
--- a/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java
+++ b/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java
@@ -29,6 +29,8 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.SystemClock;
+import android.support.v4.BuildConfig;
+import android.support.v4.content.FileProvider;
import android.util.Log;
import android.widget.Toast;
import com.google.android.apps.location.gps.gnsslogger.LoggerFragment.UIFragmentComponent;
@@ -200,10 +202,13 @@ public class FileLogger implements GnssListener {
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "SensorLog");
emailIntent.putExtra(Intent.EXTRA_TEXT, "");
// attach the file
- emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(mFile));
+ Uri fileURI =
+ FileProvider.getUriForFile(mContext, BuildConfig.APPLICATION_ID + ".provider", mFile);
+ emailIntent.putExtra(Intent.EXTRA_STREAM, fileURI);
getUiComponent().startActivity(Intent.createChooser(emailIntent, "Send log.."));
if (mFileWriter != null) {
try {
+ mFileWriter.flush();
mFileWriter.close();
mFileWriter = null;
} catch (IOException e) {
diff --git a/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/LoggerFragment.java b/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/LoggerFragment.java
index e0445a3..72f887b 100644
--- a/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/LoggerFragment.java
+++ b/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/LoggerFragment.java
@@ -117,7 +117,7 @@ public class LoggerFragment extends Fragment {
mFileLogger.send();
}
});
-
+ sendFile.setEnabled(false);
return newView;
}
diff --git a/GNSSLogger/app/src/main/res/xml/file_providers_paths.xml b/GNSSLogger/app/src/main/res/xml/file_providers_paths.xml
new file mode 100644
index 0000000..ffa74ab
--- /dev/null
+++ b/GNSSLogger/app/src/main/res/xml/file_providers_paths.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file