Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Android 10): Use ACCESS_FINE_LOCATION instead of COARSE #614

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</config-file>
</platform>
Expand Down
8 changes: 4 additions & 4 deletions src/android/BluetoothLePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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 {
Expand All @@ -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);
}
Expand Down