Reputation: 347
I am using the package react-native-permissions
and looking for the solution for the following problem
Use case:
Don't Allow
blocked
and as per my research the user now need to manually go to the settings and allow microphone.What should be the possible solution?
Is there a way the status can be set to denied
instead of blocked
, so that user can allow without leaving the app?
Upvotes: 0
Views: 1492
Reputation: 937
Unfortunately,once the user has selected "Don't Allow" for a permission request, the app cannot programmatically request the permission again without the user manually going to the device settings and granting the permission. This is a security feature implemented by the device operating system to prevent apps from repeatedly asking for permissions that the user has already denied.
Handling permissions in React Native : https://hemanthkollanur.medium.com/handling-permissions-in-react-native-c4f29cf99e7a#:~:text=The%20permissions%20dialog%20shown%20by%20the%20system,might%20find%20that%20puzzling.%20It's%20a%20good%E2%80%A6
React Native: Managing App Permissions for iOS : https://rossbulat.medium.com/react-native-managing-app-permissions-for-ios-4204e2286598
react-native-permissions : https://github.com/zoontek/react-native-permissions
import * as permissions from 'react-native-permissions';
const checkMicrophonePermission = async () => {
const result = await permissions.check(permissions.PERMISSIONS.ANDROID.RECORD_AUDIO);
if (result === 'denied')
{
alert('Microphone permission has been denied. Please go to your device settings and grant the permission manually.');
}
};
// Call the function to check the permission status
checkMicrophonePermission();
Upvotes: 2