How can I get the result of Location.enableNetworkProviderAsync()?

  1. SDK Version: 35
  2. Platforms(Android/iOS/web/all): Android

How can I get the result of the pop up dialog when using Location.enableNetworkProviderAsync(). I’ve tried:

 let isEnabled = await Location.enableNetworkProviderAsync();


 let { status } = await Location.enableNetworkProviderAsync();

but neither work…

Hey @cmacdonnacha,

Can you share the full code of your implementation as well as what describing what is currently happening when the code is executed?


Hey @adamjnav,

See a snack here: Turn on device location - Snack

I’d suggest running this using the Expo app on your phone so that you can turn off location.

Tapping “no thanks” to pop up gives no result, tapping “enable” gives back null.


Hey @adamjnav, any more thoughts on how to use this?


I’ve just given the following a try and it seems to work. Basically the promise returned by Location.enableNetworkProviderAsync() doesn’t resolve to anything. It just either resolves or rejects depending on what the user did.

The above is what the documentation means by the following:


A promise resolving as soon as the user accepts the dialog. Rejects if denied.

This is as opposed to some of the other functions that return a promise that resolves to some object/array. e.g. Location.geocodeAsync(address)


Returns a promise resolving to an array (in most cases its size is 1) of geocoded location objects […]

import React, { useState } from 'react';
import { Button, Text, View, StyleSheet } from 'react-native';
import * as Location from 'expo-location';
import Constants from 'expo-constants';

export default () => {
  const [locationStatus, setLocationStatus] = useState(null);

  return (
    <View style={styles.container}>
        onPress={() => {
            .then(() => {
            .catch(() => {
        title="Turn on Location"

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#ecf0f1',
    padding: 8,

I hope that helps :slightly_smiling_face:

1 Like

That helps thanks @wodin

1 Like

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