Location is not working.?

componentWillMount() {
if (Platform.OS === ‘android’ && !Constants.isDevice) {
errorMessage: ‘Oops, this will not work on Sketch in an Android emulator. Try it on your device!’,
} else {

_getLocationAsync = async () => {
const { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== ‘granted’) {
errorMessage: ‘Permission to access location was denied’,
await Location.getCurrentPositionAsync({ enableHighAccuracy: true })
.then(location => {
this.setState({ location });
.catch(error => {
console.log(‘error’, error);
I got an issue when i tried to run the example provided by docs as above.
Location is no any response.
I am in china. i am not sure whether it is the network issue?

1 Like

are you using ios or android?

I am using android. And i have granted the location permissions.

1 Like

if you run this snack. does it give you the correct location on your device?


Hi @ccheever , I have installed expo on my android phone.
I am using XDE run the project, Host use ‘LAN’ and protocol use ‘exp’ to share to my android phone.
i wanna run the location example. but it seem not working fine.

hi @xiezhong – did you run the snack i linked to above? you should be able to do that with just the Expo client app on your phone. What happened when you did that?

Hi @ccheever,
First it will alert me to grant location permission.
After granted.
I just get the result as following:
Change code in the editor and watch it change on your phone! Save to get a shareable url. You get a new url each time you save.

Nothing was listed under location? Hmmmm… That’s very strange.

What model of phone do you have? That code works fine for me so maybe theres some problem with your hardware or Android setup or a problem with the location code in React Native. Or maybe there’s some reason this doesn’t work in China?

If you use other apps on your phone that use location, do those work as expected?

Nothing listed under location.
My phone is Huawei P9, android version is 7.0
I just tried on iphone 6, it working fine. so definitely it’s not the reason of China.
I think it’s the component issue, hope you can fix it.
Download expo from google play is difficult in China… And i don’t have any other android phone, so sorry to provide more information to you.

Run into this topic while trying to have GPS working on Genymotion emulator. So I tried Android Emulator on linked Snack example and it doesn’t work there either. It’s working on my phone just fine. Curious what is there special about emulators that it doesn’t work. Genymotion and even the Appetize.io one has GPS emulation enabled. Yet it never resolves the promise, just keeps waiting. Might that be some internal bug in Location API with condition checking for a real device?

I’m not sure. I’m not aware of bugs in our location code, but its possible.

In my experience, simulators/emulators are not very good at peripheral things and if you want to test that stuff, it’s always best to do it on an actual physical device.

Yea, I understand, but GPS is one of the things that would best to be emulated. I don’t want to go running outside to just validate it’s working :slight_smile:

Have you tried running it in Snack simulator? Is that working for you? If you can reproduce it there, can it be issued as a bug? :slight_smile:

It works here for me in the simulator:


What SDK version are you using? If you are using an old one, upgrade to SDK 20. There might be a bug in some older SDK.

@ccheever Have you tried Android emulator in the Snack as well? Now I see that iOS one works too, but Android does not.

Got the same problem and make it work only after passing the maximumAge as a parameter and call it at componentDidMount(). After that I’ve received the location data (“expo”: “^23.0.0”).

This is probably the same issue: https://github.com/expo/expo/issues/426 please check out my comment (the last one) and let us know if this works :slight_smile:

1 Like

I think it is a known issue that Android Location API doesn’t work in China, because of Chinese government meddling the Google related functions. There is a Github project to provide location functionality in China for react native with AMap (a popular mapping service in China): https://github.com/xiaobuu/react-native-amap-location but it seems to be out of maintenance.

I have the same problem on iOS simulator, when the location on the device was set to None… just set a custom location and it will work

1 Like

hi charlie i am trying this location things from the past two days not working in my snack.

here is the link .please help . from india

no charlie it is not working dont know why sending you the link of my snack plz check it once trying it from 2 days