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.

Stop location update after location found

See original GitHub issue

I have the following issue:

I draw a marker and get the current location on load page. I drag/drop the marker to a desired location. I press the location control button to turn back to the current location.

Now I need to stop this control to update the location:

function onLocationFound(e) {
    var radius = e.accuracy / 2;
    $.get('https://nominatim.openstreetmap.org/reverse', {
        format: "json",
        addressdetails: 0,
        lat: e.latlng.lat,
        lon: e.latlng.lng
    },
            function (data) {
                $("#address").val(data.display_name);
            });

    if(typeof (marker) != "undefined") {
        marker.removeFrom(map);
        circle.removeFrom(map);
    }
    marker = L.marker(e.latlng, {draggable: true});
    marker.addTo(map)
            .bindPopup("You are within " + radius + " meters from this point").openPopup();
    marker.on('drag', onDrag);

    circle = L.circle(e.latlng, radius);
    circle.addTo(map);
    map.setView(e.latlng, 16);
    lc.stopFollowing(); // <----- I tried this but simply doesn't work.
}

How do I achieve it?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
domoritzcommented, Dec 12, 2018

Thanks for the issue. Should be fixed in v0.65.2

0reactions
domoritzcommented, Dec 12, 2018

Hmm, odd.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to stop location manager? - android - Stack Overflow
Is it possible your activity isn't being destroyed? i.e.: you hit the home button. Move your gps start/stop to onStart and onPause ....
Read more >
Request location updates - Android Developers
Stop location updates ​​ Consider whether you want to stop the location updates when the activity is no longer in focus, such as...
Read more >
Background Location Update stops r… - Apple Developer
Location monitoring has been constant and notification was triggered when the destination is within a certain distance. To do this, I've turned on:...
Read more >
Android 101: How to stop location tracking - The Verge
Uncheck “Add location information to your Tweets.” Then click on “Delete all location information.” And if it asks: yes, you are sure. Update...
Read more >
Manage your Android device's location settings
Swipe down from the top of the screen. · Touch and hold Location . If you don't find Location : Tap Edit or...
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