-
-
Notifications
You must be signed in to change notification settings - Fork 76
Android geolocation.getCurrentLocation gives error when no internet connection?? #108
Comments
For what it's worth, I'm getting the same "cannot enable location services" error simply trying to run the geolocation tutorial project from tutsplus. I've updated everything to the latest versions, as per what I could find online, but still no joy, both on an Android emulator and device. My point: the error may be more pervasive than lack of internet. |
You may need to modify the following file if the Android version is 6.0+ app/App_Resources/Android/app.gradle file: android { project.ext { This got my geolocation to work as I had trouble before with it not working at all. |
The addition to the app.gradle file solved the problem. Thanks!! |
@dlcole Your welcome! It is actually mentioned in the documentation https://github.com/NativeScript/nativescript-geolocation/blob/master/README.md towards the end. |
Does anyone still know why it don't work when the phone is in airplane mode/ no wifi or mobile data? |
@NickIliev I am testing it on Huawei p8 Lite 2017 PRA-LX1 it should work, maybe this is limited only on the nativescript-geolocation?? For what I am doing I need to be able on an Android device to get the location even when in airplane mode, it works fine without wifi/mobile data now after more testing. |
It seems the plugin still works keeping internet / wifi off. But when it's in Airplane mode (no wifi neither cellular network) but still GPS is on, it fails to detect location. The issue seems to be the check made at these lines below. In Airplane mode the location settings check fails but still location manager is capable of fetching the location. If I bypass that check and let it proceed to location manager, it returns me the right location just like Google Map does. I suggest reopening this ticket and probably discuss a way to handle this scenario.
|
To be precise, same issue is described in detail here and I believe this must be handled by the plugin. |
Make sure to check the demo app(s) for sample usage
I have, not come across anything similar
Make sure to check the existing issues in this repository
I have, not come across anything similar
If the demo apps cannot help and there is no issue for your problem, tell us about it
Location throws error when no internet connection??
Which platform(s) does your issue occur on?
Please, provide the following version numbers that your issue occurs with:
Please, tell us how to recreate the issue in as much detail as possible.
I check if the platform is Android by doing
if(app.android)
usingimport * as app from "tns-core-modules/application";
then I request location permission by doingpermissions.requestPermission(android.Manifest.permission.ACCESS_FINE_LOCATION, "")
this is all fine. But then when I callgeolocation.getCurrentLocation
it gives an error saying "cannot enable location services" when i put the mobile in airplane mode or disabled mobile data/wifi. I need the geolocation to work offline and it should be getting the location viw the GPS signal and NOT internet right??Is there any code involved?
The text was updated successfully, but these errors were encountered: