6
votes

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!

1

1 Answers

1
votes

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
    })
  }
}