Android geolocation.getCurrentLocation gives error when no internet connection??
See original GitHub issueMake 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?
- Platform: Android 7.0 Nougat
- Device: Huawei p8 Lite 2017 PRA-LX1
Please, provide the following version numbers that your issue occurs with:
"nativescript": {
"id": "testapp",
"tns-ios": {
"version": "3.4.1"
},
"tns-android": {
"version": "3.4.1"
}
},
"dependencies": {
"@angular/animations": "~5.1.0",
"@angular/common": "~5.1.0",
"@angular/compiler": "~5.1.0",
"@angular/core": "~5.1.0",
"@angular/forms": "~5.1.0",
"@angular/http": "~5.1.0",
"@angular/platform-browser": "~5.1.0",
"@angular/platform-browser-dynamic": "~5.1.0",
"@angular/router": "~5.1.0",
"nativescript-angular": "~5.1.0",
"nativescript-fontawesome": "^1.0.0",
"nativescript-geolocation": "^4.2.3",
"nativescript-google-maps-sdk": "^2.4.3",
"nativescript-localstorage": "^1.1.5",
"nativescript-permissions": "^1.2.3",
"nativescript-pro-ui": "^3.3.0",
"nativescript-screen-orientation": "^2.0.0",
"nativescript-theme-core": "~1.0.4",
"nativescript-vibrate": "^2.0.1",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.5.2",
"tns-core-modules": "~3.4.0",
"zone.js": "~0.8.18"
},
"devDependencies": {
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"lazy": "1.0.11",
"nativescript-dev-typescript": "~0.6.0",
"typescript": "~2.4.2"
},
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)
using import * as app from "tns-core-modules/application";
then I request location permission by doing permissions.requestPermission(android.Manifest.permission.ACCESS_FINE_LOCATION, "")
this is all fine. But then when I call geolocation.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?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Get current location of user in Android without using GPS or ...
This answer is wrong :-( OP asked how to get location without using an Internet connection. LOCATION_PROVIDER needs to use the Internet to ......
Read more >Geolocation API not working in Chrome on Android - Monorail
Same behaviour on Nexus 5 (Kitkat 4.4.2) running Chrome 32.0.1700.99 - NO geolocation returned using navigator.geolocation.getCurrentPosition.
Read more >Overview | Geolocation API | Google Developers
Find location based on cell towers and WiFi nodes. Learn the protocol to send this data to the server and to return a...
Read more >cordova-plugin-geolocation
Access GPS data. ... This plugin provides information about the device's location, ... If there is an error, the geolocationError callback is passed...
Read more >Geolocation API functions issue - Android Community
I need to collect the GPS coordinates of the tablet even when there is no internet connection. Permissions are granted.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The addition to the app.gradle file solved the problem. Thanks!!
You may need to modify the following file if the Android version is 6.0+
app/App_Resources/Android/app.gradle file:
android {
// other stuff here
project.ext { googlePlayServicesVersion = “11.2.+” } }
This got my geolocation to work as I had trouble before with it not working at all.