Ad

How To Auto Update Someone Location (latitude And Longitude) In Flutter

If a user opens my app, am able to get his latitude, longitude and address using Geolocator and Geocoder and when someone search for people nearby i can calculate the distance using his last known updated location and show to someone else that he is nearby

double distanceInMeters = Geolocator.distanceBetween(52.2165157, 6.9437819, 52.3546274, 4.8285838);

but what I want to do is, is there a way to automatically get his lat and long even when he isn't using the app because if he/she changes location, his last location where he last opened the app will still be showing and this might cause some confusion. Please Is there a way to do this maybe from background.

Ad

Answer

Ad
source: stackoverflow.com
Ad