The iOS version of the app requires two different permissions: Microphone and BLE. Currently, permissions are being granted on a as needed basis. However, I would like to create a page that allows a user to click on checkbox so that they can grant permission when they first start the app.
Microphone access is asked for via a method which contains the following code:
OVBluetoothManager.startDetectingNoise(NOISE_DETECT_INTERVAL);
Where NOISE_DETECT_INTERVAL is 3000.
BLE is asked for via a method that contains the following code:
OVBluetoothManager.attemptToTriggerLEPairing();
Here are the two methods inside OVBluetoothManager.m file:
RCT_EXPORT_METHOD(attemptToTriggerLEPairing)
{
[[someManager sharedInstance] getLED];
[[someManager sharedInstance] getBattery];
}
RCT_EXPORT_METHOD(startDetectingNoise:(NSInteger)timeInterval)
{
dispatch_async(dispatch_get_main_queue(), ^{
[self.noiseDetector startDetectingNoiseWithTimeIntervalInMs:timeInterval];
});
}
In both cases, the user is prompted by an Alert to grant permissions. Assuming the user grants permission, everything proceeds as usual.
In this post it was suggested that the follow code:
Permissions.request('photo').then(response => {
if (response === 'authorized') {
iPhotoPermission = true;
}
Permissions.request('contact').then(response => {
if (response === 'authorized') {
iPhotoPermission = true;
}
});
});
could grant multiple permissions at once. Is it possible to do this without using react-native-permissions?