From e7fac2751cb4e470d1252ae4123e8589778790df Mon Sep 17 00:00:00 2001 From: shengaog Date: Thu, 29 Jun 2017 22:19:15 -0700 Subject: [PATCH 1/4] Fixed File upload crashing --- GNSSLogger/app/src/main/AndroidManifest.xml | 9 +++++++++ 1 file changed, 9 insertions(+) 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 @@ + + + From 774aec52ecab73f8427eeefd96b773455051fa67 Mon Sep 17 00:00:00 2001 From: shengaog Date: Thu, 29 Jun 2017 22:19:48 -0700 Subject: [PATCH 2/4] Fixed File Crushing --- GNSSLogger/app/src/main/res/xml/file_providers_paths.xml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 GNSSLogger/app/src/main/res/xml/file_providers_paths.xml 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 From b493b8860bf1fdeabbb8cf3a1a73e2ebb4d04692 Mon Sep 17 00:00:00 2001 From: shengaog Date: Thu, 29 Jun 2017 22:20:40 -0700 Subject: [PATCH 3/4] Fixed File uploading curshing --- .../android/apps/location/gps/gnsslogger/LoggerFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From 05c183805dfb8cd8e40e59f1039fc9db9c5857fe Mon Sep 17 00:00:00 2001 From: shengaog Date: Thu, 29 Jun 2017 22:21:09 -0700 Subject: [PATCH 4/4] Fixed File upload Crushing --- .../android/apps/location/gps/gnsslogger/FileLogger.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) {