From 7bc063235ec9dea083b4da2d8a07f8cbf4503e26 Mon Sep 17 00:00:00 2001 From: hansemannn Date: Wed, 8 Jan 2020 22:37:17 +0100 Subject: [PATCH] fix: use current activity for permission check to be able to listen to the location updated immediately after granting the permission instead of closing and reopening the current view --- android/src/ti/map/TiUIMapView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/ti/map/TiUIMapView.java b/android/src/ti/map/TiUIMapView.java index 1320ef07..3b00f306 100644 --- a/android/src/ti/map/TiUIMapView.java +++ b/android/src/ti/map/TiUIMapView.java @@ -382,11 +382,11 @@ protected void setStyle(String style) protected void setUserLocationEnabled(boolean enabled) { - Context context = TiApplication.getInstance().getApplicationContext(); + Activity currentActivity = TiApplication.getAppCurrentActivity(); if (map != null && (Build.VERSION.SDK_INT < 23 - || context.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) + || currentActivity.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { map.setMyLocationEnabled(enabled); } else {