I am developing GPS based service in EXPO sdk 32.
First, use Location.getgetCurrentPositionAsync() to get the GPS value. On the iPhone, there is a return immediately, but Android will wait indefinitely for no return.
I have forced timeout, but I need this return value. Permission is normal.
I use a apple iphoneX(ios 12) and samsung galaxy note4 (SM-N916L, android 6.0.1)
It works well with Google Maps using GPS information. If the GPS information is correct, it is not a malfunction.
The code below is the same as removing Platform.OS and making it the same as Location.getCurrentPositionAsync(). I also tried accuracy to Low. it just same result…
@charliecruzan
Thanks for your answer. I try using your example source. and result is failed. weird point is that once in 10 times, the GPS value is successfully return. this is console log.
location
The following APIs have moved to separate packages and importing them from the "expo" package is deprecated: Location, Permissions.
1. Add correct versions of these packages to your project using:
expo install expo-location expo-permissions
If "install" is not recognized as an expo command, update your expo-cli installation.
2. Change your imports so they use specific packages instead of the "expo" package:
- import { Location } from 'expo' -> import * as Location from 'expo-location'
- import { Permissions } from 'expo' -> import * as Permissions from 'expo-permissions'
[Unhandled promise rejection: Error: Location provider is unavailable. Make sure that location services are enabled.]
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:155:41 in createErrorFromErrorData
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:104:55 in <unknown>
- ... 5 more stack frames from framework internals
Looks like you need to enable location services on the device. If you can reproduce this on and Android Emulator, just let me know which one and I will try on my end
But I already enable location services on my device. (wifi is connected, and the carrier is not connected.)
As a result, GPS information is returned 1 in 30 times. In most cases, however, the return value does not come. Is there anything I need to check?
I faced same issue.
It is strange because it worked yesterday but today I got this error.
And I get this error on SM-G9350 but on SM-G930S it works well.
It is very strange and I am wonder if this location function is working with standalone apps on all devices.
@charliecruzan
Sorry. I’m saw it late.
I built the app and run it standalone. When I try on a LTE network, I can’t get a GPS signal on the iPhone. (iPhoneX)
Is it an official expo bug?
We have a github issue for it (linked above), but it’s not a confirmed bug yet (need you to provide a repro, a snack works well, so that we can replicate the behavior)