Nomura Nori
Nomura Nori

Reputation: 5187

how to open dialog for asking access location permission in react native

I need to open dialog for asking user to allow location permission for application. Can I open this dialog manually? (espeically in IOS) Thank you.

Upvotes: 0

Views: 1308

Answers (1)

ajthyng
ajthyng

Reputation: 1275

Yes, if you look at the documentation for PermissionsAndroid you'll see a line in the example that says

const granted = await PermissionsAndroid.request(
  PermissionsAndroid.PERMISSIONS.CAMERA,
  {
    'title': 'Cool Photo App Camera Permission',
    'message': 'Cool Photo App needs access to your camera ' +
               'so you can take awesome pictures.'
  }
)

This section of code will bring up the system dialog that asks for permission to use the camera on behalf of your app. Make sure you also add the required permission to AndroidManifest.xml in the android/app/src/main directory by default if you used react-native init.

Upvotes: 1

Related Questions