Reputation: 1726
The react-native app I'm working on uses Bluetooth. In the IOS version, the only permission(s) that require user confirmation is attemptToTriggerLEPairing. However, in the Android version of the app, there is a method that contains the following:
PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION)
.then(granted => {
if (granted === PermissionsAndroid.RESULTS.GRANTED || granted === true) {
this.startScan();
return;
}
return PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION, {
'title': I18n.t('permission_location_title'),
'message': I18n.t('permission_location_desc')
}
)
.then(granted => {
if (granted === PermissionsAndroid.RESULTS.GRANTED || granted === true) {
this.startScan();
}
})
})
.catch(error => {
// TODO: error;
});
Why does the Android version require coarse location, but the IOS version does not?
Upvotes: 0
Views: 1352
Reputation: 420
Along with Android 10, some changes were introduced documentation
If your app targets Android 10 or higher, it must have the ACCESS_FINE_LOCATION permission in order to use several methods within the Wi-Fi, Wi-Fi Aware, or Bluetooth APIs. The following sections list the affected classes and methods.
Upvotes: 0
Reputation: 2780
As you can read on the offical documentation
Note: LE Beacons are often associated with location. In order to use BluetoothLeScanner, you must request the user's permission by declaring either the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in your app's manifest file. Without these permissions, scans won't return any results.
Upvotes: 2