REACTNATIVE : Currently using Linking.openSettings() to open my application settings page.
Now, I want to open the app permission screen directly, which is inside the App settings to enable permissions like Location, Storage etc., in both Android and iOS using REACT NATIVE.
Any possibilities? Thanks in advance!
Geolocation is enabled by default when you create a project with react-native init . In order to enable geolocation in the background, you need to include the 'NSLocationAlwaysUsageDescription' key in Info. plist and add location as a background mode in the 'Capabilities' tab in Xcode.
MainApplication" android:label="@string/app_name" ..... ..... So to integrate the permissions in our react native code, you can refer to the below code. After importing the necessary package, we can ask the user permission with PermissionsAndroid. request() method.
Shortly it's possible,
For IOS operating system, Try below,
import { Linking } from 'react-native'
Linking.openURL('app-settings:')
But Android not working with Linking,We should add two dependency,
npm install --save react-native-device-info
npm install react-native-intent-launcher
As a result,
import DeviceInfo from 'react-native-device-info';
import IntentLauncher, { IntentConstant } from 'react-native-intent-launcher'
const package= DeviceInfo.getBundleId();
const openAppSettings = () => {
if (Platform.OS === 'ios') {
Linking.openURL('app-settings:')
} else {
IntentLauncher.startActivity({
action: 'android.settings.APPLICATION_DETAILS_SETTINGS',
data: 'package:' + package
})
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With