From 27bf1a5e5a275b61c6f0f5d4d89965efd292cf84 Mon Sep 17 00:00:00 2001 From: Nuno Rodrigues Date: Tue, 16 Jun 2020 15:11:43 +0100 Subject: [PATCH] fix(Android 10): Use ACCESS_FINE_LOCATION instead of COARSE #579 --- plugin.xml | 1 + src/android/BluetoothLePlugin.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin.xml b/plugin.xml index 7802092f..6f25c2c2 100644 --- a/plugin.xml +++ b/plugin.xml @@ -23,6 +23,7 @@ + diff --git a/src/android/BluetoothLePlugin.java b/src/android/BluetoothLePlugin.java index 8e7b43d7..b86747ed 100644 --- a/src/android/BluetoothLePlugin.java +++ b/src/android/BluetoothLePlugin.java @@ -57,7 +57,7 @@ public class BluetoothLePlugin extends CordovaPlugin { //Initialization related variables private final int REQUEST_BT_ENABLE = 59627; /*Random integer*/ - private final int REQUEST_ACCESS_COARSE_LOCATION = 59628; + private final int REQUEST_ACCESS_FINE_LOCATION = 59628; private final int REQUEST_LOCATION_SOURCE_SETTINGS = 59629; private BluetoothAdapter bluetoothAdapter; private boolean isReceiverRegistered = false; @@ -872,7 +872,7 @@ private void notifyAction(JSONArray args, CallbackContext callbackContext) { public void hasPermissionAction(CallbackContext callbackContext) { JSONObject returnObj = new JSONObject(); - addProperty(returnObj, "hasPermission", cordova.hasPermission(Manifest.permission.ACCESS_COARSE_LOCATION)); + addProperty(returnObj, "hasPermission", cordova.hasPermission(Manifest.permission.ACCESS_FINE_LOCATION)); callbackContext.success(returnObj); } @@ -887,7 +887,7 @@ public void requestPermissionAction(CallbackContext callbackContext) { } permissionsCallback = callbackContext; - cordova.requestPermission(this, REQUEST_ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION); + cordova.requestPermission(this, REQUEST_ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION); } public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException { @@ -898,7 +898,7 @@ public void onRequestPermissionResult(int requestCode, String[] permissions, int //Just call hasPermission again to verify JSONObject returnObj = new JSONObject(); - addProperty(returnObj, "requestPermission", cordova.hasPermission(Manifest.permission.ACCESS_COARSE_LOCATION)); + addProperty(returnObj, "requestPermission", cordova.hasPermission(Manifest.permission.ACCESS_FINE_LOCATION)); permissionsCallback.success(returnObj); }