I have a database with coordinates of different places. Whenever a user comes to the place saved in database, a window should pop up reminding the user of coming to that place.
For that I continuously need to check the current location coordinates with the coordinates saved in database. And when a match is found, the popup window should displayed.
I can use CoreLocationManager to get current location. But how do I implement this code?
you need to create sqlite function for distance
this takes 4 arguments latitude1, longitude1, latitude2, longitude2. This will create a function in database, which will point to following function.
Now you can fire query,
Where “latitude” and “longitude” are fields of table, and “currentLatitude” and “currentLongitude” are current location coordintates.
you will get distance between your saved coordinates in database and current location coordinates.
Hope it helps.