How to request permission just using Expo?

#1

It seems requesting permission is not supported in Expo am I right?

I’ve seen checking permission in documents.
How can I request LOCATION permission to user when permission in not granted?

I don’t want to use rnpm or CRNA or detach the app.

0 Likes

#2

Use the Permissions API to ask for permissions: https://docs.expo.io/versions/latest/sdk/permissions.html. In SDK 18 this looks like:

async function getLocationAsync() {
  const { Location, Permissions } = Expo;
  const { status } = await Permissions.askAsync(Permissions.LOCATION);
  if (status === 'granted') {
    return Location.getCurrentPositionAsync({enableHighAccuracy: true});
  } else {
    throw new Error('Location permission not granted');
  }
}
0 Likes

#3

Broken on Android and ahs been for a while like lots of the other users have complained. What a shit show - I thought it was my code that was broken on some android devices but not its the getCurrentPositionAsync

Even in Expo 32

0 Likes