Skip to content

Commit

Permalink
fix(android): Allow web geolocation if only COARSE_LOCATION is granted (
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Nov 16, 2021
1 parent 8a0518b commit bc7b24e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.View;
Expand Down Expand Up @@ -280,7 +281,13 @@ public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermiss
if (isGranted) {
callback.invoke(origin, true, false);
} else {
callback.invoke(origin, false, false);
final String[] coarsePermission = { Manifest.permission.ACCESS_COARSE_LOCATION };
// TODO replace with Build.VERSION_CODES.S once we target SDK 31
if (Build.VERSION.SDK_INT >= 31 && PermissionHelper.hasPermissions(bridge.getContext(), coarsePermission)) {
callback.invoke(origin, true, false);
} else {
callback.invoke(origin, false, false);
}
}
};
permissionLauncher.launch(geoPermissions);
Expand Down

0 comments on commit bc7b24e

Please sign in to comment.