How to deal with Location disabled by the user

Hi everyone,

I wanna know how to deal with the use case when the user has the location services disable. My app uses a map, I check if the app has permissions to access location, so I check if the permission is granted or no and I deal with the case when it’s not granted, it seems that detecting if the location is disable can’t be done by asking permissions. Also I use redux to store the user’s location, and in order to avoid a crash on android I had to put an initial coords. So asking if the coords are null is not an option to me. Then I tried to create a modal that pops up when the user’s location is equals to that initial coords, but then I realized that the user’s location will always take that initial values before redux update its values with the currents location, so that modal will always pop up.

So how to detect If that service is disabled and how to open the respective section in Settings for both iOS and Android?

I am not sure how to open the settings, but you can use
Location.getProviderStatusAsync() to detect the location services status.

2 Likes

Thank you!

I found that Linking.openURL(‘app-settings:’) open the settings in iOS.
Found some libreries but that tries to open the settings but I got errors with them I don’t know if it is due to Expo

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.