I use react-native-geolocation-service for get user current location without internet and I try with your example code , my problem is when WIFI is off app give me thie error :
code:5 , Location settings are not satisfied
and when WIFI is on app work very well and give me current location
You mean the message is wrong, or it should've been a different response ?
I want get user current location without internet and send it with SMS , but when WIFI is off this library not work and give me Location settings are not satisfied and when WIFI is on without connect to the any access point this library give me Time out Error , and just worked when WIFI is connected
I don't think FusedLocationProvider supports getting location without internet. I'll look into the documentation just to be sure.
EDIT: It seems like I was right. So currently this library does not support getting location without internet.
gives me same error "Location settings are not satisfied." though mobile data wifi are turned on!
I got same error
"react": "16.7.0",
"react-native": "^0.58.3",
"react-native-geolocation-service": "^2.0.0",
Can you try using my PR/Branch,
you can pass a flag "forceRequestLocation: true" that will still try to get a location even though location settings are not satisfied.
You can use it along showLocationDialog: false
https://github.com/Agontuk/react-native-geolocation-service/pull/68
https://github.com/cladjules/react-native-geolocation-service
@cladjules i will try. thank you.
It works for me! when the device has no wifi connection or it's disabled, it still can get the GPS position.
I just changed the RNFusedLocationModule.java and LocationUtils.java files using the @cladjules branch and solved the error message "Location settings are not satisfied". It wasn't need to set any flag
Thanks!
When I put my device on airplane mode and trying to get location getting error message "Location settings are not satisfied". Is react-native-geolocation-service not works in Airplane mode? Please help.
@vikasrai1502, yes I think this library not working in airplane mode. I'm trying to search for another library which supports airplane mode but I don't find it.
any library suggestion to resolve this problem?
Now my branch was merged. I think we are halfway from having it working with airplane mode. I will look at doing another PR and some testing when in back from holidays at the end of the month.
But that's definitely doable in that project.
Thanks
@cladjules but I need the solution now
Enabling airplane mode automatically turns off wifi, enable wifi and it should work.
Any updates on this?
@entranOA I found a very good solution.
I did a project where you can see the solution
https://github.com/airtonazevedo/react-native-geolocation-offline-and-airplanemode
This library works great! Even when wifi, cellular, and bluetooth are off I can get a geolocation, but for some reason when I turn on airplane mode (Location is still on in my status bar) I get the same error as the OP: code:5 , Location settings are not satisfied. I'm on android 10 (Q) using library v4.0.0
If anyone is having this error even with wifi and mobile data turned on, put your location mode in your phone settings to device only and in the findCoordinates function set enableHighAccuracy to false.
You can try the master branch to test if location request works in airplane mode.
This is already fixed in newer versions, now it'll try to get a location fix. But it's not guaranteed.
Most helpful comment
When I put my device on airplane mode and trying to get location getting error message "Location settings are not satisfied". Is react-native-geolocation-service not works in Airplane mode? Please help.