Expo Location Permission Popup text


#1

Hello, My application just got rejected by Apple for not explaining properly why I need to access location. Current message was Allow “application name” to access the location, which is very generic. How can I customise this message to re-submit app for review.

Currently If I use Expo.Permissions.getAsync(Expo.Permissions.LOCATION) before askAsync, the expo popup will default text is still showing up.

const { status: permissionStatus } = await Expo.Permissions.getAsync(Expo.Permissions.LOCATION);

  if (permissionStatus !== 'granted') {
    Alert.alert(
      'Grant Permission',
      'App needs location access to abc.',
      [
        {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
        {text: 'OK', onPress: async () => {
          const { status } = await Expo.Permissions.askAsync(Expo.Permissions.LOCATION);
          if (status === "granted") {
            const locatio = await Expo.Location.watchPositionAsync(
              { enableHighAccuracy: true },
              callback
            );
            return locatio;
          } else {
            alert("Please Turn On your Device GPS");
          }
        }},
      ],
      { cancelable: false }
    )
  }

I am expecting my popup to show, then on user action the location permission expo popup to show but this isn’t happening.


#2

@rishabhbhatia – if you completely skip the askAsync and instead just console.log(...) there, but still do getAsync before (to debug) do you still see the Expo dialog? Trying to see if getAsync is actually causing a dialog.

Also this issue may be related: https://github.com/expo/expo/issues/1062


#3

Hello @nikki I added an alert describing why the app needs location permission, after that comes the Expo location permission alert with default text “App” would like to request access to location & Apple has now rejected me twice stating to change the message on that permission alert. Is this possible?


#4

@rishabhbhatia I am facing the same rejection from Apple and I’m implementing the same approach as yours. However, mine seems working fine.

askingForLocationPermissionAlert(
      async () => {
        const _locationPermissionStatus = await askLocationPermissionAsync();
        dispatch(startApp());
      }
    );
export const askingForLocationPermissionAlert = (confirmCallback) => {
  Alert.alert(
    'Permission',
    'blahblahblah',
    [
      { text: 'OK', onPress: confirmCallback }
    ],
    { cancelable: false }
  );
};

#5

To answer your question, it is possible to change the exact dialog.
After you build a stand alone app / detach then you open the xcode project and go into the info.plist, from there you can set the following key value pairs:

NSLocationWhenInUseUsageDescription: "This is why we need your location when you have the app open"

– or –

NSLocationAlwaysUsageDescription: "This is why we need your location all the time 😮"


#6

Hello Carson, it worked for me too. But Apple rejected the apps again. So, like Evan mentioned I modified it from app.json & both my apps were approved by apple last night. I’m adding sample app.json code below, hopefully it helps you & others.

"ios": {
  "bundleIdentifier": "com.abc.xyz",
  "config": {
    "googleSignIn": {
      "reservedClientId": "-"
    }
  },
  "infoPlist": {
    "NSLocationWhenInUseUsageDescription": "Some permission description text."
  }
},

#7

Does this require ejecting the app? I’ve added the “infoPlist” similar to what you’ve done here, with no success.


#8

Hey @devtron718 - no, this does not require ejecting, but it will only work in standalone apps, not the Expo client.