diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-08-09 16:23:23 -0400 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2016-08-09 18:50:51 -0400 |
commit | 78387e9167f1072265d6e06b4a4a423dfe405c4a (patch) | |
tree | 60ae99618b0e16c2cbd1d005add0929572af2a38 /platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp | |
parent | ddcd1f9ae045d1fec2c93f0eded48dffc5d17dae (diff) | |
download | qtlocation-mapboxgl-78387e9167f1072265d6e06b4a4a423dfe405c4a.tar.gz |
[android] fix location permissions already accepted
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java index 5c5236ee91..69e9cf0488 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java @@ -68,8 +68,9 @@ public class FeatureOverviewActivity extends AppCompatActivity { int itemPosition = sectionAdapter.getConvertedPosition(position); Feature feature = features.get(itemPosition); if (feature.isRequiresLocationPermission()) { - requestLocationPermission(itemPosition); - return; + if (requestLocationPermission(itemPosition)) { + return; + } } startFeature(feature); } @@ -117,10 +118,13 @@ public class FeatureOverviewActivity extends AppCompatActivity { startActivity(intent); } - private void requestLocationPermission(final int positionInList) { + private boolean requestLocationPermission(final int positionInList) { if ((ContextCompat.checkSelfPermission(FeatureOverviewActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) || (ContextCompat.checkSelfPermission(FeatureOverviewActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) { ActivityCompat.requestPermissions(FeatureOverviewActivity.this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, positionInList); + return true; + } else { + return false; } } |