question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Timeout searching for location on Android (Nativescript 3.0.3)

See original GitHub issue

I saw issues reported on forum and this repository about issues on reading location on Android on NS3.0. I just want to report that it also not working on Nativescript Sample application.

Steps to reproduce:

The plugin runs fine on iOS.

Attached please found the screenshot for your reference.

Versions: │ Component │ Current version │ Latest version │ Information │ │ nativescript │ 3.0.3 │ 3.0.3 │ Up to date │ │ tns-core-modules │ 3.0.1 │ 3.0.1 │ Up to date │ │ tns-android │ 3.0.1 │ 3.0.1 │ Up to date │ │ tns-ios │ 3.0.1 │ 3.0.1 │ Up to date │

Hope this can help and let me know if need any further information.

Regards Clarence ns-android-location-error

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:44 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
F481commented, Aug 19, 2017

Hi guys, please try to set the “desiredAccuracy” option to “Accuracy.high” (see https://docs.nativescript.org/hardware/location#getcurrentlocation). That solved the problem for me 👍

2reactions
TinoNcommented, Aug 29, 2017

nativescript-geolocation plugin version: 3.0.1

I had the same problem as described. Apparently first you have to call .watchLocation(); This seems to trigger the retrieval of the current GPS data. I am using my device (XiaoMi 5S) directly without emulator.

So here is what I did (I practically called .getCurrentLocation(...); and .clearWatch(watchId); after .watchLocation();:

function buttonGetLocationTap(args) {
    if (!geolocation.isEnabled()) {
        geolocation.enableLocationRequest();
    }

    watchId = geolocation.watchLocation();

    var location = geolocation.getCurrentLocation({desiredAccuracy: 3, updateDistance: 5, timeout: 20000})
    .then(function(loc) {
        if (loc) {
            console.log("Latitude " + loc.latitude);
            console.log("Longitude " + loc.longitude);
            console.log("Altitude " + loc.altitude);
            console.log("Horizontal Accuracy " + loc.horizontalAccuracy);
            console.log("Vertical Accuracy " + loc.verticalAccuracy);
            console.log("Speed " + loc.speed);
            console.log("Direction " + loc.direction);
            console.log("Timestamp " + loc.timestamp);

            geolocation.clearWatch(watchId);
        }
    }, function(e){
        console.log("Error: " + e.message);
        geolocation.clearWatch(watchId);
    });
}
exports.buttonGetLocationTap = buttonGetLocationTap;

Hope it helps. Regards!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Geolocation - NativeScript Docs
Geolocation plugin to use for getting current location, monitor movement, etc. ... Required only when requesting background location access on Android 10 ...
Read more >
React Native Android location request timed out - Stack Overflow
It works fine. On Android side its not stable as IOS. This problem both in real device and emulator. Sometimes it can find...
Read more >
Nativescript Location Plugin Only Opens Location Settings - ADocLib
Geolocation plugin to use for getting current location monitor movement etc.Timeout searching for location on Android Nativescript 3.0.3. Implement ...
Read more >
@klippa/nativescript-http - npm
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like ...
Read more >
nativescript/CHANGELOG.md - UNPKG
The CDN for nativescript. ... 28, * With older CLI versions you were able to run `tns debug android` and ... Add command...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found