diff --git a/README.md b/README.md index fac9d3c..d26206f 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ export ANDROID_HOME=/path/to/android-sdk

diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 204569c..9bdb78f 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ + diff --git a/src/main/assets/news.xml b/src/main/assets/news.xml index 301783e..efcba85 100644 --- a/src/main/assets/news.xml +++ b/src/main/assets/news.xml @@ -3,6 +3,7 @@
  • Input can now be scanned from QR code.
  • Map can be centered to target.
  • +
  • Fixed issue with selecting map file on Android 7.
  • Improved French translation.
  • diff --git a/src/main/java/menion/android/whereyougo/gui/activity/MainActivity.java b/src/main/java/menion/android/whereyougo/gui/activity/MainActivity.java index 2dc7f3c..1131424 100644 --- a/src/main/java/menion/android/whereyougo/gui/activity/MainActivity.java +++ b/src/main/java/menion/android/whereyougo/gui/activity/MainActivity.java @@ -18,6 +18,7 @@ package menion.android.whereyougo.gui.activity; import android.Manifest; +import android.annotation.TargetApi; import android.app.Activity; import android.app.NotificationManager; import android.content.Context; @@ -25,6 +26,7 @@ import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; @@ -335,10 +337,12 @@ private boolean isAnyCartridgeAvailable() { } } + @TargetApi(Build.VERSION_CODES.M) private void checkPermissions() { final String[] permissions = new String[] { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, }; @@ -362,7 +366,9 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - checkPermissions(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + checkPermissions(); + } if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { Intent intent = new Intent(getIntent()); diff --git a/src/main/java/menion/android/whereyougo/maps/mapsforge/filepicker/FilePicker.java b/src/main/java/menion/android/whereyougo/maps/mapsforge/filepicker/FilePicker.java index 3306ce7..67cbb43 100644 --- a/src/main/java/menion/android/whereyougo/maps/mapsforge/filepicker/FilePicker.java +++ b/src/main/java/menion/android/whereyougo/maps/mapsforge/filepicker/FilePicker.java @@ -21,6 +21,7 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle; +import android.os.Environment; import android.preference.PreferenceManager; import android.view.View; import android.view.WindowManager; @@ -237,6 +238,9 @@ protected void onResume() { if (!this.currentDirectory.exists() || !this.currentDirectory.canRead()) { this.currentDirectory = new File(DEFAULT_DIRECTORY); } + if (!this.currentDirectory.exists() || !this.currentDirectory.canRead()) { + this.currentDirectory = Environment.getExternalStorageDirectory(); + } browseToCurrentDirectory(); } }