Browse Source

Merge pull request #4 from shengaog/master

Fixed File Upload Crushing
pull/2/merge 1.4.0.0
mohammedkhider 7 years ago committed by GitHub
parent
commit
0a64bf68fc
  1. 9
      GNSSLogger/app/src/main/AndroidManifest.xml
  2. 7
      GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java
  3. 2
      GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/LoggerFragment.java
  4. 4
      GNSSLogger/app/src/main/res/xml/file_providers_paths.xml

9
GNSSLogger/app/src/main/AndroidManifest.xml

@ -19,5 +19,14 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="android.support.v4.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_providers_paths"/>
</provider>
</application>
</manifest>

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.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) {

2
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;
}

4
GNSSLogger/app/src/main/res/xml/file_providers_paths.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
Loading…
Cancel
Save