Skip to content

Commit

Permalink
fix: use current activity for permission check
Browse files Browse the repository at this point in the history
to be able to listen to the location updated immediately after granting the permission instead of closing and reopening the current view
  • Loading branch information
hansemannn committed Jan 8, 2020
1 parent fac8c27 commit 7bc0632
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions android/src/ti/map/TiUIMapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7bc0632

Please sign in to comment.