Browse Source

Fixed File upload Crushing

pull/4/head
shengaog 8 years ago committed by GitHub
parent
commit
05c183805d
  1. 7
      GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java

7
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.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.BuildConfig;
import android.support.v4.content.FileProvider;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.apps.location.gps.gnsslogger.LoggerFragment.UIFragmentComponent; 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_SUBJECT, "SensorLog");
emailIntent.putExtra(Intent.EXTRA_TEXT, ""); emailIntent.putExtra(Intent.EXTRA_TEXT, "");
// attach the file // 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..")); getUiComponent().startActivity(Intent.createChooser(emailIntent, "Send log.."));
if (mFileWriter != null) { if (mFileWriter != null) {
try { try {
mFileWriter.flush();
mFileWriter.close(); mFileWriter.close();
mFileWriter = null; mFileWriter = null;
} catch (IOException e) { } catch (IOException e) {

Loading…
Cancel
Save